Dasttann777 Posted April 22, 2012 Share Posted April 22, 2012 I am in the middle of Building a notepad clone known as Hunterpad, but I am stuck on the New function. I tried to make a function that exits Hunterpad and then Reopens it, but I cantwork out the code for that, any help? Here is my Code: #include <GUIConstants.au3> Opt("TrayMenuMode", 1) $Form1 = GUICreate("Hunterpad", 1112, 561, 147, 112) GUICtrlCreateEdit("", 0, 32, 1361, 673) GUICtrlSetData(-1, "") $File = GUICtrlCreateMenu("&File") $New = GUICtrlCreateMenuItem("New", $File) $MenuItem4 = GUICtrlCreateMenuItem("Save", $File) $MenuItem5 = GUICtrlCreateMenuItem("Save As...", $File) $MenuItem7 = GUICtrlCreateMenuItem("Print", $File) $MenuItem6 = GUICtrlCreateMenuItem("Exit", $File) $MenuItem1 = GUICtrlCreateMenu("&Edit") $MenuItem8 = GUICtrlCreateMenuItem("Undo", $MenuItem1) $MenuItem9 = GUICtrlCreateMenuItem("Redo", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("&Tools") $MenuItem10 = GUICtrlCreateMenuItem("Font..", $MenuItem2) $MenuItem11 = GUICtrlCreateMenuItem("Size", $MenuItem2) $MenuItem3 = GUICtrlCreateMenu("&Help") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $New Exit Run("Hunterpad.exe") Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 22, 2012 Moderators Share Posted April 22, 2012 Dasttann777, Try this: Case $New ; Open a new instance Run("Hunterpad.exe") ; Close the current instance Exit M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 22, 2012 Author Share Posted April 22, 2012 Sortof, your code shuts down the program, I want one that refreshes the Program. Is it possible? Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 22, 2012 Moderators Share Posted April 22, 2012 Dasttann777, a function that exits Hunterpad and then Reopens itThat is what you asked for and that is what I gave you. With your new information I suggest what you want to do is to empty the edit control: #include <GUIConstants.au3> Opt("TrayMenuMode", 1) $Form1 = GUICreate("Hunterpad", 1112, 561, 147, 112) $cEdit = GUICtrlCreateEdit("", 0, 32, 1361, 673) ; Note the ControlID <<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSetData(-1, "") $File = GUICtrlCreateMenu("&File") $New = GUICtrlCreateMenuItem("New", $File) $MenuItem4 = GUICtrlCreateMenuItem("Save", $File) $MenuItem5 = GUICtrlCreateMenuItem("Save As...", $File) $MenuItem7 = GUICtrlCreateMenuItem("Print", $File) $MenuItem6 = GUICtrlCreateMenuItem("Exit", $File) $MenuItem1 = GUICtrlCreateMenu("&Edit") $MenuItem8 = GUICtrlCreateMenuItem("Undo", $MenuItem1) $MenuItem9 = GUICtrlCreateMenuItem("Redo", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("&Tools") $MenuItem10 = GUICtrlCreateMenuItem("Font..", $MenuItem2) $MenuItem11 = GUICtrlCreateMenuItem("Size", $MenuItem2) $MenuItem3 = GUICtrlCreateMenu("&Help") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $New GUICtrlSetData($cEdit, "") ; Empty the control <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd That is a pretty basic thing to solve - have you done much coding before? If not then might I suggest the excellent tutorials that you will find here and here - it might save you a lot of frustration in the future. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 22, 2012 Author Share Posted April 22, 2012 Thankyou and I am sorry for frustration. Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 22, 2012 Author Share Posted April 22, 2012 Hi again, sorry for my continuous asking for help, but the tutorials are not giving me enough info. I want to create a save box that: 1. Saves the File(My one opens up the dialog, but wont save. 2.Once Saved, does not need to be saved again. Here is my Code: #include <GUIConstants.au3> #include <WinAPI.au3> Opt("TrayMenuMode", 1) $Form1 = GUICreate("Hunterpad", 1112, 561, 147, 112) $cEdit = GUICtrlCreateEdit("", 0, 32, 1361, 673) ; Note the ControlID <<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSetData(-1, "") $File = GUICtrlCreateMenu("&File") $New = GUICtrlCreateMenuItem("New", $File) $MenuItem4 = GUICtrlCreateMenuItem("Save", $File) $MenuItem5 = GUICtrlCreateMenuItem("Save As...", $File) $Save = GUICtrlCreateMenuItem("Open",$File) $MenuItem7 = GUICtrlCreateMenuItem("Print", $File) $MenuItem6 = GUICtrlCreateMenuItem("Exit", $File) $MenuItem1 = GUICtrlCreateMenu("&Edit") $MenuItem8 = GUICtrlCreateMenuItem("Undo", $MenuItem1) $MenuItem9 = GUICtrlCreateMenuItem("Redo", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("&Tools") $MenuItem10 = GUICtrlCreateMenuItem("Font..", $MenuItem2) $MenuItem11 = GUICtrlCreateMenuItem("Size", $MenuItem2) $MenuItem3 = GUICtrlCreateMenu("&Help") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $New GUICtrlSetData($cEdit, "") ; Empty the control <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Case $GUI_EVENT_CLOSE Exit Case $MenuItem4 FileSaveDialog("Save","C:","All(*.*)",16,"untitled") EndSwitch WEnd Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 22, 2012 Moderators Share Posted April 22, 2012 Dasttann777,The dialog only returns the name of the file to save, you still have to save it yourself. And you will need to check if the content has been changed if you want to prevent saving the same data again:Case $MenuItem4 ; Get current content of edit control $sCurrent_Edit = GUICtrlRead($cEdit) ; Has it changed? If $sCurrent_Edit <> $sSaved_Edit Then ; Get a filename to save to $sFile = FileSaveDialog("Save", "C:", "All(*.*)", 16, "untitled") ; Open a file overwriting any existing one $hFile FileOpen($sFile, 2) ; Write the file with the current data FileWrite($hFile, $sCurrent_Edit) ; Close the file FileClose($hFile) ; Store the current content for future comparisons $sSaved_Edit = $sCurrent_Edit EndIfPersonally I would look at hashing the edit content with _Crypt_HashData so that the size of the comparison variable does not get too large - but we might leave that to another day. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 22, 2012 Author Share Posted April 22, 2012 Thankyou so much! Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 22, 2012 Author Share Posted April 22, 2012 The code is not working: expandcollapse popup#include <GUIConstants.au3> #include <WinAPI.au3> Opt("TrayMenuMode", 1) $Form1 = GUICreate("Hunterpad", 1112, 561, 147, 112) $cEdit = GUICtrlCreateEdit("", 0, 32, 1361, 673) ; Note the ControlID <<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSetData(-1, "") $File = GUICtrlCreateMenu("&File") $New = GUICtrlCreateMenuItem("New", $File) $MenuItem4 = GUICtrlCreateMenuItem("Save", $File) $MenuItem5 = GUICtrlCreateMenuItem("Save As...", $File) $Save = GUICtrlCreateMenuItem("Open",$File) $MenuItem7 = GUICtrlCreateMenuItem("Print", $File) $MenuItem6 = GUICtrlCreateMenuItem("Exit", $File) $MenuItem1 = GUICtrlCreateMenu("&Edit") $MenuItem8 = GUICtrlCreateMenuItem("Undo", $MenuItem1) $MenuItem9 = GUICtrlCreateMenuItem("Redo", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("&Tools") $MenuItem10 = GUICtrlCreateMenuItem("Font..", $MenuItem2) $MenuItem11 = GUICtrlCreateMenuItem("Size", $MenuItem2) $MenuItem3 = GUICtrlCreateMenu("&Help") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $New GUICtrlSetData($cEdit, "") ; Empty the control <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Case $GUI_EVENT_CLOSE Exit Case $MenuItem4 ; Get current content of edit control $sCurrent_Edit = GUICtrlRead($cEdit) ; Has it changed? If $sCurrent_Edit <> $sSaved_Edit Then ; Get a filename to save to $sFile = FileSaveDialog("Save", "C:", "All(*.*)", 16, "untitled") ; Open a file overwriting any existing one $hFile FileOpen($sFile, 2) ; Write the file with the current data FileWrite($hFile, $sCurrent_Edit) ; Close the file FileClose($hFile) ; Store the current content for future comparisons $sSaved_Edit = $sCurrent_Edit EndIf EndSwitch WEnd Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 22, 2012 Moderators Share Posted April 22, 2012 Dasttann777, Apologies I missed a critical line when I cut and pasted: Local $sSaved_Edit = "" ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $New GUICtrlSetData($cEdit, "") ; Empty the control Case $GUI_EVENT_CLOSE Exit Case $MenuItem4 ; Get current content of edit control $sCurrent_Edit = GUICtrlRead($cEdit) ; Has it changed? If $sCurrent_Edit <> $sSaved_Edit Then ; Get a filename to save to $sFile = FileSaveDialog("Save", "C:", "All(*.*)", 16, "untitled") ; Open a file overwriting any existing one $hFile = FileOpen($sFile, 2) ; Write the file with the current data FileWrite($hFile, $sCurrent_Edit) ; Close the file FileClose($hFile) ; Store the current content for future comparisons $sSaved_Edit = $sCurrent_Edit EndIf EndSwitch WEnd M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 22, 2012 Author Share Posted April 22, 2012 Thankyou so much for the help, I will try to program the rest by myself, but if I need help, do I post in this forum topic, or in a new one? Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 23, 2012 Author Share Posted April 23, 2012 (edited) I have managed to Create 4 New Functions on my own, but now I want to create a change font dialogue, but when I try and create one, the Main GUI does not stay on the screen, but disappears after a second, any help? expandcollapse popup#include <GUIConstants.au3> #include <WinAPI.au3> #Include <GuiEdit.au3> Opt("TrayMenuMode", 1) $Form1 = GUICreate("Hunterpad", 1112, 561, 147, 112) $cEdit = GUICtrlCreateEdit("", 0, 32, 1361, 673) GUICtrlSetData(-1, "") $File = GUICtrlCreateMenu("&File") $New = GUICtrlCreateMenuItem("New", $File) $MenuItem4 = GUICtrlCreateMenuItem("Save", $File) $MenuItem5 = GUICtrlCreateMenuItem("Save As...", $File) $Save = GUICtrlCreateMenuItem("Open",$File) $MenuItem7 = GUICtrlCreateMenuItem("Print", $File) $MenuItem6 = GUICtrlCreateMenuItem("Exit", $File) $MenuItem1 = GUICtrlCreateMenu("&Edit") $MenuItem8 = GUICtrlCreateMenuItem("Undo Ctrl-Z", $MenuItem1) $MenuItem9 = GUICtrlCreateMenuItem("Redo Ctrl-Y", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("&Tools") $MenuItem10 = GUICtrlCreateMenuItem("Font..", $MenuItem2) $MenuItem11 = GUICtrlCreateMenuItem("Size", $MenuItem2) $MenuItem3 = GUICtrlCreateMenu("&Help") GUISetState(@SW_SHOW) Local $sSaved_Edit = "" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $New GUICtrlSetData($cEdit, "") ; Empty the control Case $GUI_EVENT_CLOSE Exit Case $Save $FileOpen = FileOpenDialog("","","(*.*)") $FileRead = FileRead($FileOpen) Send($FileRead) Case $MenuItem7 $sPrintFile = "c:image.png" Run('Rundll32.exe "' & @SystemDir & 'mshtml.dll",PrintHTML "' & $sPrintFile & '"', @SystemDir) Case $MenuItem6 Exit Case $MenuItem4 ; Get current content of edit control $sCurrent_Edit = GUICtrlRead($cEdit) ; Has it changed? If $sCurrent_Edit <> $sSaved_Edit Then ; Get a filename to save to $sFile = FileSaveDialog("Save", "C:", "All(*.*)", 16, "untitled") ; Open a file overwriting any existing one $hFile = FileOpen($sFile, 2) ; Write the file with the current data FileWrite($hFile, $sCurrent_Edit) ; Close the file FileClose($hFile) ; Store the current content for future comparisons $sSaved_Edit = $sCurrent_Edit EndIf Case $MenuItem8 _GUICtrlEdit_Undo($cEdit) Case $MenuItem10 GUICreate("Font") $FONTCHANGE = GUICtrlCreateButton("Change",100,100) $FontExample = GUICtrlCreateLabel("The quick brown fox jumps over the lazy dog",50,50) GUISetState(@SW_SHOW) Case $FONTCHANGE GUICtrlSetFont($FontExample, +1) EndSwitch WEnd Edited April 23, 2012 by Dasttann777 Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 23, 2012 Moderators Share Posted April 23, 2012 Dasttann777,Take a look at the Managing Multiple GUIs tutorial in the Wiki - that will show you how to deal with dialogs such as the one you are creating. A couple of tips:- 1. Give your menuitems sensible names - it will make coding much easier. - 2. Do you really think your GUICtrlSetFont code will work as it is? To what are you adding 1 each time you press the button? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
guinness Posted April 23, 2012 Share Posted April 23, 2012 Dasttann777, Great you're getting into AutoIt, but I'm just curious to know, are you building a 'Notepad clone' to improve your knowledge of AutoIt or Notepad? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 24, 2012 Author Share Posted April 24, 2012 I am building a Clone so I can learn the Ropes of Autoit, that is all. And I am still working on the FOnt, I just needed help with this problem. Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Skitty Posted April 24, 2012 Share Posted April 24, 2012 I am building a Clone so I can learn the Ropes of Autoit, that is all.And I am still working on the FOnt, I just needed help with this problem.Best way I'd recommend a user learn autoit is by randomly searching for cool scripts, play with them and change stuff until you mess it up. Gives you a good feel of how autoit works.I've also made a habit of saving every script that seems interesting to me in a folder called "script bank", it's already grown to be 150+ mb and it's very damn handy to use when creating new scripts because I tend to separate functions that do an intended action into categories, this way I can just do a quick search through the folder, and I'll have a working script in no-time after a few copy and paste maneuvers. I've probably got at least 30% of all the scripts in the example section separated and categorized in there. Dasttann777 and armoros 2 Link to comment Share on other sites More sharing options...
Dasttann777 Posted April 24, 2012 Author Share Posted April 24, 2012 Best way I'd recommend a user learn autoit is by randomly searching for cool scripts, play with them and change stuff until you mess it up. Gives you a good feel of how autoit works.I've also made a habit of saving every script that seems interesting to me in a folder called "script bank", it's already grown to be 150+ mb and it's very damn handy to use when creating new scripts because I tend to separate functions that do an intended action into categories, this way I can just do a quick search through the folder, and I'll have a working script in no-time after a few copy and paste maneuvers.I've probably got at least 30% of all the scripts in the example section separated and categorized in there.Yeah Okay, thanks for the advice!! Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Dasttann777 Posted May 2, 2012 Author Share Posted May 2, 2012 Hi I have done quite well so far, but I am having trouble on this one function. I am trying to create a HTML Button, that when pressed will send the phrase "<html></html>", but when I made the function, it just played up. Here is the Code: expandcollapse popup#include <GUIConstants.au3> #include <WinAPI.au3> Opt("TrayMenuMode", 1) $Form1 = GUICreate("Hunterpad", 1112, 561, 147, 112) $cEdit = GUICtrlCreateEdit("", 0, 32, 1361, 673) GUICtrlSetData(-1, "") $File = GUICtrlCreateMenu("&File") $New = GUICtrlCreateMenuItem("New", $File) $MenuItem4 = GUICtrlCreateMenuItem("Save", $File) $MenuItem5 = GUICtrlCreateMenuItem("Save As...", $File) $Save = GUICtrlCreateMenuItem("Open", $File) $MenuItem7 = GUICtrlCreateMenuItem("Print", $File) $MenuItem6 = GUICtrlCreateMenuItem("Exit", $File) $MenuItem1 = GUICtrlCreateMenu("&Edit") $MenuItem8 = GUICtrlCreateMenuItem("Undo (Press Ctrl-Z)", $MenuItem1) $MenuItem9 = GUICtrlCreateMenuItem("Redo (Press Ctrl-Y)", $MenuItem1) $MenuItem3 = GUICtrlCreateMenu("&Help") $About = GUICtrlCreateMenuItem("About... (Shuts down Hunterpad)", $MenuItem3) $HTU = GUICtrlCreateMenuItem("&Help (Shuts down Hunterpad)", $MenuItem3) $HTML = GUICtrlCreateButton("&Html",20,5) GUISetState(@SW_SHOW) Local $sSaved_Edit = "" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $HTML Send("<html></html>") Case $New GUICtrlSetData($cEdit, "") ; Empty the control Case $GUI_EVENT_CLOSE Exit Case $Save $FileOpen = FileOpenDialog("", "", "(*.*)") $FileRead = FileRead($FileOpen) Send($FileRead) Case $MenuItem7 $sPrintFile = "c:image.png" Case $HTU MsgBox(0, "Help", "Hunterpad is easy to use, and very basic. ||Change Notes: 1.0 - Hunterpad Released Here are the current Hotkeys: Ctrl-Z - Undo Ctrl-Y - Redo") Case $About MsgBox(0, "About", "Made by Dasttann_Software Designer_Website Builder_Computer Fanatic>>>>>>>>>>>Hunter Version: 1.0>>>>>>>>>>>>>>") Run('Rundll32.exe "' & @SystemDir & 'mshtml.dll",PrintHTML "' & $sPrintFile & '"', @SystemDir) Case $MenuItem6 Exit Case $MenuItem4 ; Get current content of edit control $sCurrent_Edit = GUICtrlRead($cEdit) ; Has it changed? If $sCurrent_Edit <> $sSaved_Edit Then ; Get a filename to save to $sFile = FileSaveDialog("Save", "C:", "All(*.*)", 16, "untitled") ; Open a file overwriting any existing one $hFile = FileOpen($sFile, 2) ; Write the file with the current data FileWrite($hFile, $sCurrent_Edit) ; Close the file FileClose($hFile) ; Store the current content for future comparisons $sSaved_Edit = $sCurrent_Edit EndIf EndSwitch WEnd Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
guinness Posted May 2, 2012 Share Posted May 2, 2012 You should know by now that when you want to add data to an AutoIt Edit control you use GUICtrlSetData not Send. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Dasttann777 Posted May 3, 2012 Author Share Posted May 3, 2012 (edited) Thankyou so much for the help. I am in the middle of adding mre functions to my Hunterpad known as "Traps", in which you type in a group of text, and then when you click on the Release Button, the text you wrote in the Trap Window will be inserted into the text. I have done quite well so far, but the text replaces all of my other text, instead of adding it. Should I use a string, or what do I do? My Code: expandcollapse popup#include <GUIConstants.au3> #include <GuiStatusBar.au3> #include <WinAPI.au3> Opt("TrayMenuMode", 1) $Form1 = GUICreate("Hunterpad", 1112, 561, 147, 112) $cEdit = GUICtrlCreateEdit("", 0, 32, 1361, 673) GUICtrlSetData(-1, "") GUICtrlCreateLabel(StringLen($cEdit),50,10) $File = GUICtrlCreateMenu("&File") $New = GUICtrlCreateMenuItem("New", $File) $MenuItem4 = GUICtrlCreateMenuItem("Save", $File) $MenuItem5 = GUICtrlCreateMenuItem("Save As...", $File) $Save = GUICtrlCreateMenuItem("Open", $File) $MenuItem7 = GUICtrlCreateMenuItem("Print", $File) $MenuItem6 = GUICtrlCreateMenuItem("Exit", $File) $MenuItem1 = GUICtrlCreateMenu("&Edit") $MenuItem8 = GUICtrlCreateMenuItem("Undo (Press Ctrl-Z)", $MenuItem1) $MenuItem9 = GUICtrlCreateMenuItem("Redo (Press Ctrl-Y)", $MenuItem1) $MenuItem3 = GUICtrlCreateMenu("&Help") $About = GUICtrlCreateMenuItem("About... (Shuts down Hunterpad)", $MenuItem3) $HTU = GUICtrlCreateMenuItem("&Help ", $MenuItem3) $HTML = GUICtrlCreateButton("&Html",20,5) $Pin1 = GUICtrlCreateButton("Rusty Trap",100,5) $Release = GUICtrlCreateButton("Release Rusty",160,5) _GUICtrlStatusBar_Create($cEdit) GUISetState(@SW_SHOW) Local $sSaved_Edit = "" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $HTML GUICtrlSetData($cEdit,"<html><head></head><body></body></html>") Case $Pin1 $PinI = InputBox("Rusty Trap", "Have a document Draft, that you do not want to lose, but need to temporarily store? Copy and Paste the Text into here, you can reuse it with the Release Rusty Button!(Use Carefully as it will replace all of your current text") Case $New GUICtrlSetData($cEdit, "") ; Empty the control Case $GUI_EVENT_CLOSE Exit Case $Release GUICtrlSetData($cEdit,$PinI) Case $Save $FileOpen = FileOpenDialog("", "", "Html Documents(* .html)|Text Documents(*.txt)|All(*.*)") $FileRead = FileRead($FileOpen) Send($FileRead) Case $MenuItem7 $sPrintFile = "c:image.png" Case $HTU MsgBox(0, "Help", "Hunterpad is easy to use, and very basic. ||Change Notes: 1.0 - Hunterpad Released Here are the current Hotkeys: Ctrl-Z - Undo Ctrl-Y - Redo") Case $About MsgBox(0, "About", "Made by Dasttann_Software Designer_Website Builder_Computer Fanatic>>>>>>>>>>>Hunter Version: 1.0>>>>>>>>>>>>>>") Run('Rundll32.exe "' & @SystemDir & 'mshtml.dll",PrintHTML "' & $sPrintFile & '"', @SystemDir) Case $MenuItem6 Exit Case $MenuItem4 ; Get current content of edit control $sCurrent_Edit = GUICtrlRead($cEdit) ; Has it changed? If $sCurrent_Edit <> $sSaved_Edit Then ; Get a filename to save to $sFile = FileSaveDialog("Save", "C:", "All(*.*)", 16, "untitled") ; Open a file overwriting any existing one $hFile = FileOpen($sFile, 2) ; Write the file with the current data FileWrite($hFile, $sCurrent_Edit) ; Close the file FileClose($hFile) ; Store the current content for future comparisons $sSaved_Edit = $sCurrent_Edit EndIf EndSwitch WEnd Much Help will be appreciated Edited May 4, 2012 by Dasttann777 Check out my new site!Current Projects:[list][*]Hunter Console - A Small Gadget[*]HunterPad - Basic Notepad aimed at Programmers[*]Betters UP! - Betting Game[/list] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now