NerdFencer Posted February 11, 2010 Share Posted February 11, 2010 (edited) In an attempt to avoid repetitive work, here is a script that generates basic scripts. Working off of the premise that there are only a few basic types of script that you usually make in AutoIt. This script quickly generates shell scripts for the 4 most common ones (GUI scripts, Tray Apps, UDF scripts, and Automation scripts). For GUI Scripts, it generates functional, blank, single GUI or multi-GUI scripts. For Tray Scripts, it generates functional, blank, normal or on-event scripts. For UDF Scripts, it generates the blank sections of the UDF needed for your UDF, and inserts a blank copy of the Function documentation block and the no doc function documentation block. For Automation Scripts, it can generate anything from basic "proceed with this operation" front-ends, to multi-function "select which task to perform" front-ends. Also has "Downloading Auto-Installer" as an option. Comments/Suggestions welcome Updated to v0.4 -Added Tray app generation -Added Downloading Auto-Installer to Tools -Added /Install Param to compiled EXE for adding to the tools menu in scite -Made the generated scripts open once done Updated to v0.3 -All checkbox-type options now saved -Added On-event GUI shell -Added ROME GUI Generation -Added ROME API Module Generation -Added Skip Index Generation for Automated Tasks -Added Preview to the GUI shell tab Updated to v0.2 -Added save to directory -Save the global options expandcollapse popup#NoTrayIcon #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars",1) If $CmdLine[0]==1 Then If $CmdLine[1] == "/Install" Then Install() EndIf #Region ; Init Global $gui = GUICreate("AutoIt Shell Program Creator v0.4",400,300,0,0) Global $previewGUI = "NULL", $tmp, $SavedBox = "" ; Common Little Options GUICtrlCreateGroup("Common little options",5,5,190,100) Global $trayico = GUICtrlCreateCheckbox("Hide Tray Icon",15,20) Global $declare = GUICtrlCreateCheckbox("Must Declare Variables",15,40) Global $readmin = GUICtrlCreateCheckbox("Require Administrator",15,60) Global $optsize = GUICtrlCreateCheckbox("Optomize for Compiled Size",15,80) $SavedBox &= "$trayico,$declare,$readmin,$optsize" ; Global Script Options GUICtrlCreateGroup("Global Script Options",205,5,190,100) GUICtrlCreateLabel("Title:",210,22) Global $name = GUICtrlCreateInput(IniRead("Settings.ini","Global Script Options","Title",""),245,20,145,19) GUICtrlCreateLabel("Author:",210,42) Global $author = GUICtrlCreateInput(IniRead("Settings.ini","Global Script Options","Author",""),245,40,145,19) GUICtrlCreateLabel("about:",210,62) Global $about = GUICtrlCreateInput(IniRead("Settings.ini","Global Script Options","About",""),245,60,145,19) GUICtrlCreateLabel("Dir:",210,82) Global $dir = GUICtrlCreateInput(IniRead("Settings.ini","Global Script Options","Dir",""),245,80,128,19) Global $sdir= GUICtrlCreateIcon("shell32.dll",4,374,81,16,16) ; Script Type GUICtrlCreateTab(5,110,390,185) GUICtrlCreateTabItem("GUI Script") GUICtrlCreateGroup("GUI Options",15,135,190,150) GUICtrlCreateLabel("GUI Title:",20,157) Global $GUI_Title = GUICtrlCreateInput("",70,155,125,19) GUICtrlCreateLabel("X:",20,182) Global $GUI_X = GUICtrlCreateInput("400",40,180,55,19,0x2000) Global $GUI_Xud = GUICtrlCreateUpdown($GUI_X,0x80) GUICtrlSetLimit($GUI_Xud,2048,-1) GUICtrlCreateLabel("Y:",110,182) Global $GUI_Y = GUICtrlCreateInput("300",130,180,55,19,0x2000) Global $GUI_Yud = GUICtrlCreateUpdown($GUI_Y,0x80) GUICtrlSetLimit($GUI_Yud,2048,-1) Global $GUI_Type = GUICtrlCreateCombo("Select GUI Type",20,205,175,22) Global $GUI_Index = GUICtrlCreateCheckbox("Skip Index Creation",20,230) GUICtrlSetData($GUI_Type,"Standard|Borderless|Toolwindow") GUICtrlCreateGroup("System Options",210,135,175,120) Global $GUI_SingleG = GUICtrlCreateRadio("Single GUI System (Global)",220,150) Global $GUI_SingleC = GUICtrlCreateRadio("Single GUI System (Capsule)",220,170) Global $GUI_MultiD = GUICtrlCreateRadio("Multi GUI System (Dynamic)",220,190) Global $GUI_OnEvent = GUICtrlCreateRadio("On Event GUI System",220,210) Global $GUI_ROME = GUICtrlCreateRadio("ROME GUI Module",220,230) $SavedBox &= ",$GUI_SingleG,$GUI_SingleC,$GUI_MultiD,$GUI_OnEvent,$GUI_ROME" Global $GUI_Preview = GUICtrlCreateButton("Preview",210,265,85,22) Global $GUI_Generate = GUICtrlCreateButton("Generate",300,265,85,22) GUICtrlCreateTabItem("Tray App") GUICtrlCreateGroup("Tray App Options",15,135,190,150) Global $TA_Xindx = GUICtrlCreateCheckbox("Skip Index Creation",20,152) $SavedBox &= ",$TA_Xindx" GUICtrlCreateGroup("Tray App Type",210,135,175,120) Global $TA_Standard = GUICtrlCreateRadio("Standard",220,155) Global $TA_Encapsulated = GUICtrlCreateRadio("Standard (Encapsulated)",220,175) Global $TA_OnEvent = GUICtrlCreateRadio("On Event",220,195) Global $TA_Generate = GUICtrlCreateButton("Generate",300,265,85,22) $SavedBox &= ",$TA_Standard,$TA_Encapsulated,$TA_OnEvent,$TA_Generate" GUICtrlCreateTabItem("UDF") GUICtrlCreateGroup("UDF Options",15,135,190,150) Global $UDF_Xindx = GUICtrlCreateCheckbox("Skip Index Creation",20,152) Global $UDF_Xvars = GUICtrlCreateCheckbox("No 'Variables' Section",20,172) Global $UDF_Xconst = GUICtrlCreateCheckbox("No 'Constants' Section",20,192) Global $UDF_Xinter = GUICtrlCreateCheckbox("No 'Internal use only' Section",20,212) Global $UDF_Xnodoc = GUICtrlCreateCheckbox("No 'NoDoc Function' Section",20,232) Global $UDF_ROME = GUICtrlCreateCheckbox("Make as ROME API Module",20,252) $SavedBox &= ",$UDF_Xindx,$UDF_Xvars,$UDF_Xconst,$UDF_Xinter,$UDF_Xnodoc,$UDF_ROME" GUICtrlCreateGroup("UDF Type",210,135,175,120) Global $UDF_Constants = GUICtrlCreateRadio("Constants Only",220,155) Global $UDF_SingleF = GUICtrlCreateRadio("Single Function (Minimal)",220,175) Global $UDF_MultiF = GUICtrlCreateRadio("Multi-Function (Full)",220,195) $SavedBox &= ",$UDF_Constants,$UDF_SingleF,$UDF_MultiF" Global $UDF_Generate = GUICtrlCreateButton("Generate",300,265,85,22) GUICtrlCreateTabItem("Automated Task") GUICtrlCreateGroup("Automated Task Options",15,135,190,150) Global $AT_Xindx = GUICtrlCreateCheckbox("Skip Index Creation",20,152) $SavedBox &= ",$AT_Xindx" GUICtrlCreateGroup("Automated Task Type",210,135,175,120) Global $AT_AutoInst = GUICtrlCreateRadio("Downloading Auto-Installer",220,150) Global $AT_Dialog = GUICtrlCreateRadio("Request Dialog",220,170) Global $AT_DProg = GUICtrlCreateRadio("Request Dialog (Progress)",220,190) Global $AT_MTask = GUICtrlCreateRadio("Multi-Task Dialog",220,210) Global $AT_MTaskP = GUICtrlCreateRadio("Multi-Task Dialog (Progress)",220,230) $SavedBox &= ",$AT_AutoInst,$AT_Dialog,$AT_DProg,$AT_MTask,$AT_MTaskP" Global $AT_Generate = GUICtrlCreateButton("Generate",300,265,85,22) GUISetState() #EndRegion ReadStates() Main() Func Main() Local $msg While 1 $msg = GUIGetMsg(1) Switch $msg[0] Case -3 If $msg[1]==$gui Then IniWrite("Settings.ini","Global Script Options","Title",GUICtrlRead($name)) IniWrite("Settings.ini","Global Script Options","Author",GUICtrlRead($author)) IniWrite("Settings.ini","Global Script Options","About",GUICtrlRead($about)) IniWrite("Settings.ini","Global Script Options","Dir",GUICtrlRead($dir)) WriteStates() Exit Else GUIDelete($previewGUI) $previewGUI = "NULL" EndIf Case $sdir GUICtrlSetData($dir,FileSelectFolder("Select a Folder",""),2) Case $GUI_Generate Global $tmp = GUICtrlRead($dir)&GUICtrlRead($name)&".au3" FileDelete($tmp) GenerateHeader($tmp) FileWriteLine($tmp,@CRLF&"#include <GuiConstantsEx.au3>"&@CRLF&"#include <WindowsConstants.au3>") If Not(BitAND(GUICtrlRead($GUI_Index), $GUI_CHECKED) = $GUI_CHECKED) Then GenerateIndex(GUICtrlRead($name)&".au3") If BitAND(GUICtrlRead($GUI_SingleG), $GUI_CHECKED) = $GUI_CHECKED Then GenerateSingleGuiGlobal($tmp) ElseIf BitAND(GUICtrlRead($GUI_SingleC), $GUI_CHECKED) = $GUI_CHECKED Then GenerateSingleGuiCapsule($tmp) ElseIf BitAND(GUICtrlRead($GUI_MultiD), $GUI_CHECKED) = $GUI_CHECKED Then GenerateMultiGuiDynamic($tmp) ElseIf BitAND(GUICtrlRead($GUI_OnEvent), $GUI_CHECKED) = $GUI_CHECKED Then GenerateOnEventGui($tmp) ElseIf BitAND(GUICtrlRead($GUI_ROME), $GUI_CHECKED) = $GUI_CHECKED Then GenerateRomeGui($tmp) IniWrite(GUICtrlRead($dir)&"module.ini","Module","Include",GUICtrlRead($name)&".au3") IniWrite(GUICtrlRead($dir)&"module.ini","Module","InitItems",StringLeft(StringReplace(GUICtrlRead($name)," ",""),3)&"_InitEntry") EndIf ShellExecute($tmp) Case $GUI_Preview If Not($previewGUI=="NULL") Then GUIDelete($previewGUI) EndIf $previewGUI = Execute(GenerateGuiCreateCode()) GUISetState(@SW_SHOW,$previewGUI) Case $UDF_Generate $tmp = GUICtrlRead($dir)&GUICtrlRead($name)&".au3" FileDelete($tmp) GenerateHeader($tmp) If BitAND(GUICtrlRead($UDF_ROME), $GUI_CHECKED) = $GUI_CHECKED Then FileWriteLine($tmp,"#include "&Chr(34)&"API.au3"&Chr(34)) EndIf If Not(BitAND(GUICtrlRead($UDF_Xindx), $GUI_CHECKED) = $GUI_CHECKED) Then GenerateIndex(GUICtrlRead($name)&".au3") GenerateUdf($tmp) ShellExecute($tmp) Case $TA_Generate $tmp = GUICtrlRead($dir)&GUICtrlRead($name)&".au3" FileDelete($tmp) GenerateHeader($tmp) If Not(BitAND(GUICtrlRead($TA_Xindx), $GUI_CHECKED) = $GUI_CHECKED) Then GenerateIndex($tmp) If BitAND(GUICtrlRead($TA_Standard), $GUI_CHECKED) = $GUI_CHECKED Then GenerateStdTray($tmp) ElseIf BitAND(GUICtrlRead($TA_Encapsulated), $GUI_CHECKED) = $GUI_CHECKED Then GenerateCpsTray($tmp) ElseIf BitAND(GUICtrlRead($TA_OnEvent), $GUI_CHECKED) = $GUI_CHECKED Then GenerateEventTray($tmp) EndIf ShellExecute($tmp) Case $AT_Generate $tmp = GUICtrlRead($dir)&GUICtrlRead($name)&".au3" FileDelete($tmp) If BitAND(GUICtrlRead($AT_AutoInst), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($readmin,$GUI_CHECKED) GenerateHeader($tmp) If Not(BitAND(GUICtrlRead($AT_Xindx), $GUI_CHECKED) = $GUI_CHECKED) Then GenerateIndex($tmp) If BitAND(GUICtrlRead($AT_Dialog), $GUI_CHECKED) = $GUI_CHECKED Then GenerateRequestDialog($tmp) ElseIf BitAND(GUICtrlRead($AT_DProg), $GUI_CHECKED) = $GUI_CHECKED Then GenerateRequestDialogP($tmp) ElseIf BitAND(GUICtrlRead($AT_MTask), $GUI_CHECKED) = $GUI_CHECKED Then GenerateMultiDialog($tmp) ElseIf BitAND(GUICtrlRead($AT_MTaskP), $GUI_CHECKED) = $GUI_CHECKED Then GenerateMultiDialogP($tmp) ElseIf BitAND(GUICtrlRead($AT_AutoInst), $GUI_CHECKED) = $GUI_CHECKED Then GenerateDownloadingInstaller($tmp) EndIf ShellExecute($tmp) EndSwitch Sleep(15) WEnd EndFunc #Region ; S/r Func WriteStates() Local $boxes = StringSplit($SavedBox,",") For $i=1 To $boxes[0] If BitAND(GUICtrlRead(Execute($boxes[$i])), $GUI_CHECKED) == $GUI_CHECKED Then IniWrite("Settings.ini","Checkboxes",StringTrimLeft($boxes[$i],1),"Checked") Else IniWrite("Settings.ini","Checkboxes",StringTrimLeft($boxes[$i],1),"Unchecked") EndIf Next EndFunc Func ReadStates() Local $boxes = StringSplit($SavedBox,",") For $i=1 To $boxes[0] If IniRead("Settings.ini","Checkboxes",StringTrimLeft($boxes[$i],1),"Unchecked") == "Checked" Then GUICtrlSetState(Execute($boxes[$i]),$GUI_CHECKED) Else GUICtrlSetState(Execute($boxes[$i]),$GUI_UNCHECKED) EndIf Next EndFunc Func Install() Local $result, $string_to_append, $file_handle, $test Local $File_au3_properties = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","InstallDir") & "\SciTE\Properties\au3.properties" If Not FileExists($File_au3_properties) Then Return For $i = 5 To 100 $result = StringInStr($File_au3_properties,"command." & $i & ".$") If $result == 0 Then DirCreate(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","InstallDir") & "\SciTE\ShellScriptCreator") FileCopy(@ScriptFullPath,RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt","InstallDir") & "\SciTE\ShellScriptCreator\ShellScriptCreator.exe",1) $string_to_append = @CRLF & @CRLF & "#x " & $i & " Create basic shell scripts for AutoIt" & @CRLF & _ "command.name." & $i & ".$(au3)=Shell Script Creator" & @CRLF & _ "command.shortcut." & $i & ".$(au3)=Ctrl+Shift+C" & @CRLF & _ 'command.' & $i & '.$(au3)="$(SciteDefaultHome)\ShellScriptCreator\ShellScriptCreator.exe"' & ' "$(FilePath)"' $file_handle = FileOpen($File_au3_properties,1) $test = FileWrite($file_handle,$string_to_append) If $test == 1 Then MsgBox(48,"Installed","Shell Script Creator Will now appear in your SCITE tools menu.") EndIf FileClose($file_handle) ExitLoop EndIf Next EndFunc #EndRegion ; S/r #Region ;Head Func GenerateHeader($file) ; Au3 Options Local $Au3Options = "#include-once" & @CRLF If GUICtrlRead($trayico) == $GUI_CHECKED Then $Au3Options &= "#NoTrayIcon" & @CRLF EndIf If GUICtrlRead($readmin) == $GUI_CHECKED Then $Au3Options &= "#RequireAdmin" & @CRLF EndIf If GUICtrlRead($declare) == $GUI_CHECKED Then $Au3Options &= "Opt('MustDeclareVars',1)" & @CRLF EndIf ; Au3 Wrapper Local $Au3Wrapper = "" If GUICtrlRead($optsize) == $GUI_CHECKED Then $Au3Wrapper &= "#Region ;**** Directives created by AutoIt3Wrapper_GUI ****" & @CRLF $Au3Wrapper &= "#AutoIt3Wrapper_Compression=4" & @CRLF $Au3Wrapper &= "#AutoIt3Wrapper_Run_Obfuscator=y" & @CRLF $Au3Wrapper &= "#Obfuscator_Parameters=/SO" & @CRLF $Au3Wrapper &= "#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****" & @CRLF EndIf ; Write to file FileWriteLine($file,$Au3Options) FileWriteLine($file,$Au3Wrapper) EndFunc Func GenerateIndex($file) ; Index Local $index = "" $index &= "; #INDEX# =======================================================================================================================" & @CRLF $index &= "; Title .........: " & GUICtrlRead($name) & @CRLF $index &= "; AutoIt Version : 3.3" & @CRLF $index &= "; Language ......: English" & @CRLF $index &= "; Description ...: " & GUICtrlRead($about) & @CRLF $index &= "; Author(s) .....: " & GUICtrlRead($author) & @CRLF $index &= "; Dll ...........:" & @CRLF $index &= "; ===============================================================================================================================" ; Write to file FileWriteLine($file,@CRLF&$index) EndFunc #EndRegion ;Head #Region ;Tray Func GenerateStdTray($file) Local $sys = "Opt('TrayAutoPause', 0)"&@CRLF $sys &= "Opt('TrayMenuMode', 1)"&@CRLF&@CRLF $sys &= "Global $hExit = TrayCreateItem('Exit')"&@CRLF&@CRLF $sys &= "ProcessTrayMsgs()"&@CRLF $sys &= "Func ProcessTrayMsgs()"&@CRLF $sys &= " Local $iMsg"&@CRLF $sys &= " While 1"&@CRLF $sys &= " $iMsg = TrayGetMsg()"&@CRLF $sys &= " Switch $iMsg"&@CRLF $sys &= " Case $hExit"&@CRLF $sys &= " Exit"&@CRLF $sys &= " EndSwitch"&@CRLF $sys &= " Sleep(15)"&@CRLF $sys &= " WEnd"&@CRLF $sys &= "EndFunc"&@CRLF ; Write to file FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateCpsTray($file) Local $sys = "Opt('TrayAutoPause', 0)"&@CRLF $sys &= "Opt('TrayMenuMode', 1)"&@CRLF&@CRLF $sys &= "Main()"&@CRLF $sys &= "Func Main()"&@CRLF $sys &= " local $hExit = TrayCreateItem('Exit')"&@CRLF $sys &= " Local $iMsg"&@CRLF $sys &= " While 1"&@CRLF $sys &= " $iMsg = TrayGetMsg()"&@CRLF $sys &= " Switch $iMsg"&@CRLF $sys &= " Case $hExit"&@CRLF $sys &= " Exit"&@CRLF $sys &= " EndSwitch"&@CRLF $sys &= " Sleep(15)"&@CRLF $sys &= " WEnd"&@CRLF $sys &= "EndFunc"&@CRLF ; Write to file FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateEventTray($file) Local $sys = "Opt('TrayAutoPause', 0)"&@CRLF $sys &= "Opt('TrayMenuMode', 1)"&@CRLF $sys &= "Opt('TrayOnEventMode', 1)"&@CRLF&@CRLF $sys &= "Global $hExit = TrayCreateItem('Exit')"&@CRLF $sys &= "TrayItemSetOnEvent($hExit,'ProcessTrayMsgs')"&@CRLF&@CRLF $sys &= "While 1"&@CRLF $sys &= " Sleep(10000)"&@CRLF $sys &= "WEnd"&@CRLF&@CRLF $sys &= "Func ProcessTrayMsgs()"&@CRLF $sys &= " Switch @TRAY_ID"&@CRLF $sys &= " Case $hExit"&@CRLF $sys &= " Exit"&@CRLF $sys &= " EndSwitch"&@CRLF $sys &= "EndFunc"&@CRLF ; Write to file FileWriteLine($file,@CRLF&$sys) EndFunc #EndRegion ;Tray #Region ;Auto Func GenerateRequestDialog($file) Local $sys = @CRLF $sys &= "; This calls a dialog to requst executing your task, and notifies the user when it is complete"&@CRLF $sys &= "_RequestDialog()"&@CRLF $sys &= "Func _RequestDialog()"&@CRLF $sys &= " Local $iResult = MsgBox(1,'"&GUICtrlRead($name)&"','"&GUICtrlRead($name)&" is requesting your permission to execute.')"&@CRLF $sys &= " If $iResult==1 Then"&@CRLF $sys &= " $iResult=AutomatedTask()"&@CRLF $sys &= " If $iResult==True Then"&@CRLF $sys &= " MsgBox(0,'Success','The specified task completed successfully!')"&@CRLF $sys &= " Else"&@CRLF $sys &= " MsgBox(0,'Failure','The specified task failed to complete.')"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Exit"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF $sys &= "; Your task, return true if successful or false if it failed"&@CRLF $sys &= "Func AutomatedTask()"&@CRLF $sys &= " Return True"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF ; Write to file FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateRequestDialogP($file) Local $sys = "Global $hProgrss, $hGUI, $hLabel"&@CRLF&@CRLF $sys &= "; This calls a dialog to requst executing your task, and notifies the user when it is complete"&@CRLF $sys &= "_RequestDialog()"&@CRLF $sys &= "Func _RequestDialog()"&@CRLF $sys &= " Local $iResult = MsgBox(1,'"&GUICtrlRead($name)&"','"&GUICtrlRead($name)&" is requesting your permission to execute.')"&@CRLF $sys &= " If $iResult==1 Then ; Only executes if they press yes"&@CRLF $sys &= " ; Initialize the GUI"&@CRLF $sys &= " $hGUI = GUICreate('"&GUICtrlRead($name)&"',300,100)"&@CRLF $sys &= " $hProgrss = GUICtrlCreateProgress(5,5,290,50)"&@CRLF $sys &= " $hLabel = GUICtrlCreateLabel('Executing...',5,65,290,35)"&@CRLF $sys &= " GUISetState()"&@CRLF $sys &= " ; Run the task"&@CRLF $sys &= " $iResult=AutomatedTask()"&@CRLF $sys &= " ; set completion message"&@CRLF $sys &= " If $iResult==True Then"&@CRLF $sys &= " GUICtrlSetData($hLabel,'Task Completed Successfully!')"&@CRLF $sys &= " Else"&@CRLF $sys &= " GUICtrlSetData($hLabel,'Task Failed to Complete.')"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " ; wait for the user to quit"&@CRLF $sys &= " While _GuiCallback()"&@CRLF $sys &= " Sleep(15)"&@CRLF $sys &= " WEnd"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Exit"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF $sys &= "; Returns true, or false if the user tries to quit"&@CRLF $sys &= "Func _GuiCallback()"&@CRLF $sys &= " Return Not(GUIGetMsg()==-3)"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF $sys &= "; Your task, return true if successful or false if it failed"&@CRLF $sys &= "Func AutomatedTask()"&@CRLF $sys &= " GUICtrlSetData($hProgrss,0)"&@CRLF $sys &= " Return True"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF ; Write to file FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateMultiDialog($file) Local $sys = "; Variables used for menu system"&@CRLF $sys &= "Global $aTasks[1][3], $hStatus"&@CRLF $sys &= "; Register Tasks Here"&@CRLF $sys &= "_Register('MsgBox Example','msgbox(0,0,0)','This is an example that illustrates how to call _Register. It will display a pointless message box.')"&@CRLF&@CRLF $sys &= "; Execute Menu"&@CRLF $sys &= "_Menu()"&@CRLF $sys &= "Func _Menu()"&@CRLF $sys &= " Local $hGui = GUICreate('"&GUICtrlRead($name)&"',300,100)"&@CRLF $sys &= " Local $hCombo = GUICtrlCreateCombo($aTasks[0][0],5,5,290,22)"&@CRLF $sys &= " Local $hExecute = GUICtrlCreateButton('Execute',200,73,95,22)"&@CRLF $sys &= " Local $hDescription = GUICtrlCreateLabel($aTasks[0][2],5,31,290,40)"&@CRLF $sys &= " ; Globalized to allow for custom status setting"&@CRLF $sys &= " $hStatus = GUICtrlCreateLabel('Please Select an option to execute.',5,77,190,20)"&@CRLF $sys &= " GUICtrlSetColor($hStatus,0x999999)"&@CRLF $sys &= " For $i=1 To UBound($aTasks)-2"&@CRLF $sys &= " GUICtrlSetData($hCombo,$aTasks[$i][0])"&@CRLF $sys &= " Next"&@CRLF $sys &= " GUISetState(@SW_SHOW,$hGui)"&@CRLF $sys &= " Local $msg"&@CRLF $sys &= " While 1"&@CRLF $sys &= " $msg = GUIGetMsg()"&@CRLF $sys &= " Switch $msg"&@CRLF $sys &= " Case -3"&@CRLF $sys &= " Exit"&@CRLF $sys &= " Case $hCombo"&@CRLF $sys &= " For $i=0 To UBound($aTasks)-2"&@CRLF $sys &= " If GUICtrlRead($hCombo)==$aTasks[$i][0] Then"&@CRLF $sys &= " GUICtrlSetData($hDescription,$aTasks[$i][2])"&@CRLF $sys &= " ExitLoop"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Next"&@CRLF $sys &= " Case $hExecute"&@CRLF $sys &= " For $i=0 To UBound($aTasks)-2"&@CRLF $sys &= " If GUICtrlRead($hCombo)==$aTasks[$i][0] Then"&@CRLF $sys &= " GUICtrlSetData($hStatus,'Executing...')"&@CRLF $sys &= " GUICtrlSetData($hStatus,'Finished: '&Execute($aTasks[$i][1]))"&@CRLF $sys &= " ExitLoop"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Next"&@CRLF $sys &= " EndSwitch"&@CRLF $sys &= " Sleep(15)"&@CRLF $sys &= " WEnd"&@CRLF $sys &= "EndFunc"&@CRLF $sys &= "Func _Register($sName, $sCall, $sDescription='')"&@CRLF $sys &= " $aTasks[UBound($aTasks)-1][0] = $sName"&@CRLF $sys &= " $aTasks[UBound($aTasks)-1][1] = $sCall"&@CRLF $sys &= " $aTasks[UBound($aTasks)-1][2] = $sDescription"&@CRLF $sys &= " ReDim $aTasks[UBound($aTasks)+1][3]"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF ; Write to file FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateMultiDialogP($file) Local $sys = "; Variables used for menu system"&@CRLF $sys &= "Global $aTasks[1][3], $hStatus, $hProgress"&@CRLF $sys &= "; Register Tasks Here"&@CRLF $sys &= "_Register('MsgBox Example','msgbox(0,0,0)','This is an example that illustrates how to call _Register. It will display a pointless message box.')"&@CRLF&@CRLF $sys &= "; Execute Menu"&@CRLF $sys &= "_Menu()"&@CRLF $sys &= "Func _Menu()"&@CRLF $sys &= " Local $hGui = GUICreate('"&GUICtrlRead($name)&"',300,130)"&@CRLF $sys &= " Local $hCombo = GUICtrlCreateCombo($aTasks[0][0],5,5,290,22)"&@CRLF $sys &= " Local $hExecute = GUICtrlCreateButton('Execute',200,103,95,22)"&@CRLF $sys &= " Local $hDescription = GUICtrlCreateLabel($aTasks[0][2],5,31,290,40)"&@CRLF $sys &= " ; Globalized to allow for custom status setting"&@CRLF $sys &= " $hStatus = GUICtrlCreateLabel('Please Select an option to execute.',5,107,190,20)"&@CRLF $sys &= " $hProgress = GUICtrlCreateProgress(5,73,290,25)"&@CRLF $sys &= " GUICtrlSetColor($hStatus,0x999999)"&@CRLF $sys &= " For $i=1 To UBound($aTasks)-2"&@CRLF $sys &= " GUICtrlSetData($hCombo,$aTasks[$i][0])"&@CRLF $sys &= " Next"&@CRLF $sys &= " GUISetState(@SW_SHOW,$hGui)"&@CRLF $sys &= " Local $msg"&@CRLF $sys &= " While 1"&@CRLF $sys &= " $msg = GUIGetMsg()"&@CRLF $sys &= " Switch $msg"&@CRLF $sys &= " Case -3"&@CRLF $sys &= " Exit"&@CRLF $sys &= " Case $hCombo"&@CRLF $sys &= " For $i=0 To UBound($aTasks)-2"&@CRLF $sys &= " If GUICtrlRead($hCombo)==$aTasks[$i][0] Then"&@CRLF $sys &= " GUICtrlSetData($hDescription,$aTasks[$i][2])"&@CRLF $sys &= " ExitLoop"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Next"&@CRLF $sys &= " Case $hExecute"&@CRLF $sys &= " For $i=0 To UBound($aTasks)-2"&@CRLF $sys &= " If GUICtrlRead($hCombo)==$aTasks[$i][0] Then"&@CRLF $sys &= " GUICtrlSetData($hProgress,0)"&@CRLF $sys &= " GUICtrlSetData($hStatus,'Executing...')"&@CRLF $sys &= " GUICtrlSetData($hStatus,'Finished: '&Execute($aTasks[$i][1]))"&@CRLF $sys &= " GUICtrlSetData($hProgress,100)"&@CRLF $sys &= " ExitLoop"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Next"&@CRLF $sys &= " EndSwitch"&@CRLF $sys &= " Sleep(15)"&@CRLF $sys &= " WEnd"&@CRLF $sys &= "EndFunc"&@CRLF $sys &= "Func _Register($sName, $sCall, $sDescription='')"&@CRLF $sys &= " $aTasks[UBound($aTasks)-1][0] = $sName"&@CRLF $sys &= " $aTasks[UBound($aTasks)-1][1] = $sCall"&@CRLF $sys &= " $aTasks[UBound($aTasks)-1][2] = $sDescription"&@CRLF $sys &= " ReDim $aTasks[UBound($aTasks)+1][3]"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF ; Write to file FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateDownloadingInstaller($file) Local $sys = "; -----------------------------------------------------------------"&@CRLF $sys &= "; Here Be The Land of Ease!"&@CRLF $sys &= "; AKA: All you need to do is set these variables and you are done"&@CRLF $sys &= "; -----------------------------------------------------------------"&@CRLF $sys &= "; This is the name of the installer: What to title the GUI"&@CRLF $sys &= "Global Const $ProgName = '"&GUICtrlRead($name)&"'"&@CRLF $sys &= "; -----------------------------------------------------------------"&@CRLF $sys &= "; Name of the program"&@CRLF $sys &= "Global Const $name = ''"&@CRLF $sys &= "; -----------------------------------------------------------------"&@CRLF $sys &= "; The URL to the installer"&@CRLF $sys &= "Global Const $url = ''"&@CRLF $sys &= "; -----------------------------------------------------------------"&@CRLF $sys &= "; What to name the downloaded file"&@CRLF $sys &= "Global Const $file = 'Setup.exe'"&@CRLF $sys &= "; -----------------------------------------------------------------"&@CRLF $sys &= "; The silent install perameter for the program"&@CRLF $sys &= "; Usually one of these: /S /silent /q /quiet"&@CRLF $sys &= "; If you dont know first try the documentation then these sites"&@CRLF $sys &= "; http://www.appdeploy.com/"&@CRLF $sys &= "; http://unattended.sourceforge.net/installers.php"&@CRLF $sys &= "Global Const $param = '/S'"&@CRLF $sys &= "; -----------------------------------------------------------------"&@CRLF $sys &= "; Aproximate time the process will take"&@CRLF $sys &= "Global Const $time = '1-3 Minutes'"&@CRLF $sys &= "; -----------------------------------------------------------------"&@CRLF $sys &= "; Should it always re-download the file?"&@CRLF $sys &= "Global Const $ForceFileUpdate = True"&@CRLF&@CRLF $sys &= "; -----------------------------------------------------------------"&@CRLF $sys &= "; Here Be Dragons!"&@CRLF $sys &= "; AKA: unless doing something advanced, you can stop here"&@CRLF $sys &= "; -----------------------------------------------------------------"&@CRLF&@CRLF $sys &= "; Create the GUI"&@CRLF $sys &= "Global $gui = GUICreate($ProgName,300,95,0,0)"&@CRLF $sys &= "Global $step = GUICtrlCreateLabel('...',5,5,290)"&@CRLF $sys &= "Global $state = GUICtrlCreateLabel('...',15,25,280)"&@CRLF $sys &= "Global $progress = GUICtrlCreateProgress(5,45,290,30)"&@CRLF $sys &= "Global $ETR = GUICtrlCreateLabel('Estimated Time: ',5,80,300)"&@CRLF $sys &= "GUISetState(@SW_SHOW,$gui)"&@CRLF $sys &= "ExecuteBasicInstall()"&@CRLF $sys &= "If $ForceFileUpdate Then FileDelete($file)"&@CRLF&@CRLF $sys &= "; This is the core of the install process"&@CRLF $sys &= "Func ExecuteBasicInstall($chunks=2)"&@CRLF $sys &= " GUICtrlSetData($ETR,'Estimated Time: '&$time)"&@CRLF $sys &= " Local $success = DownloadFile($name,$file,$url)"&@CRLF $sys &= " If $success==False Then"&@CRLF $sys &= " Return False"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " GUICtrlSetData($step,$name&' - Installing...')"&@CRLF $sys &= " GUICtrlSetData($state,'')"&@CRLF $sys &= " GUICtrlSetData($progress,100/$chunks)"&@CRLF $sys &= " ShellExecuteWait($file,$param)"&@CRLF $sys &= " ShellExecute('shutdown','-a',Default,Default,@SW_HIDE)"&@CRLF $sys &= " GUICtrlSetData($progress,200/$chunks)"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF $sys &= "; Download the file"&@CRLF $sys &= "Func DownloadFile($name, $outfile, $url, $silent = False)"&@CRLF $sys &= " If FileExists($outfile) Then"&@CRLF $sys &= " If $ForceFileUpdate == False Then"&@CRLF $sys &= " Return"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " FileDelete($outfile)"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " If FileExists($outfile) == 1 And FileDelete($outfile) == 0 Then"&@CRLF $sys &= " If $silent == False Then"&@CRLF $sys &= " MsgBox(0, 'Error Downloading ' & $name, $name & ' Failed to download because the output file could not be accessed.', 5000)"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Return SetError(1, 1, False)"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " GUICtrlSetData($step, $name & ' - Initializing Download...')"&@CRLF $sys &= " GUICtrlSetData($state, '')"&@CRLF $sys &= " GUICtrlSetData($progress, 0)"&@CRLF $sys &= " Local $InetHandle = InetGet($url, $outfile, 1, 1)"&@CRLF $sys &= " While Int(100 * InetGetInfo($InetHandle, 0) / InetGetInfo($InetHandle, 1)) < 0"&@CRLF $sys &= " $msg = GUIGetMsg(1)"&@CRLF $sys &= " If $msg[1] == $gui And $msg[0] == -3 Then"&@CRLF $sys &= " If MsgBox(4, 'Abort Download', 'Are you sure you want to cancel the download of ' & $name) == 6 Then"&@CRLF $sys &= " InetClose($InetHandle)"&@CRLF $sys &= " FileDelete($outfile)"&@CRLF $sys &= " Return SetError(1, 2, False)"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Sleep(15)"&@CRLF $sys &= " WEnd"&@CRLF $sys &= " GUICtrlSetData($step, $name & ' - Downloading...')"&@CRLF $sys &= " Local $msg"&@CRLF $sys &= " While Not InetGetInfo($InetHandle, 2)"&@CRLF $sys &= " GUICtrlSetData($progress, 100 * InetGetInfo($InetHandle, 0) / InetGetInfo($InetHandle, 1))"&@CRLF $sys &= " GUICtrlSetData($state, Int(100 * InetGetInfo($InetHandle, 0) / InetGetInfo($InetHandle, 1)) & '% - ' & Round(InetGetInfo($InetHandle, 0) / (1024 ^ 2), 1) & '/' & Round(InetGetInfo($InetHandle, 1) / (1024 ^ 2), 1) & ' MB')"&@CRLF $sys &= " $msg = GUIGetMsg(1)"&@CRLF $sys &= " If $msg[1] == $gui And $msg[0] == -3 Then"&@CRLF $sys &= " If MsgBox(4, 'Abort Download', 'Are you sure you want to cancel the download of ' & $name) == 6 Then"&@CRLF $sys &= " InetClose($InetHandle)"&@CRLF $sys &= " FileDelete($outfile)"&@CRLF $sys &= " Return SetError(1, 2, False)"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Sleep(50)"&@CRLF $sys &= " WEnd"&@CRLF $sys &= " Return SetError(0, 0, True)"&@CRLF $sys &= "EndFunc ;==>DownloadFile"&@CRLF ; Write to file FileWriteLine($file,@CRLF&$sys) EndFunc #EndRegion ;Auto #Region ;UDF Func GenerateUdf($file) Local $sys = "" If Not(BitAND(GUICtrlRead($UDF_Xvars),$GUI_CHECKED)==$GUI_CHECKED) And Not(BitAND(GUICtrlRead($UDF_Constants), $GUI_CHECKED) = $GUI_CHECKED) Then $sys &= "; #VARIABLES# ==================================================================================================================="&@CRLF $sys &= "; ==============================================================================================================================="&@CRLF&@CRLF EndIf If Not(BitAND(GUICtrlRead($UDF_Xconst),$GUI_CHECKED)==$GUI_CHECKED) Then $sys &= "; #CONSTANTS# ==================================================================================================================="&@CRLF $sys &= "; ==============================================================================================================================="&@CRLF&@CRLF EndIf If BitAND(GUICtrlRead($UDF_MultiF), $GUI_CHECKED) = $GUI_CHECKED Then If Not(BitAND(GUICtrlRead($UDF_Xnodoc),$GUI_CHECKED)==$GUI_CHECKED) Then $sys &= "; #NO_DOC_FUNCTION# ============================================================================================================="&@CRLF $sys &= "; ==============================================================================================================================="&@CRLF&@CRLF EndIf $sys &= "; #CURRENT# ====================================================================================================================="&@CRLF $sys &= "; ==============================================================================================================================="&@CRLF&@CRLF If Not(BitAND(GUICtrlRead($UDF_Xinter),$GUI_CHECKED)==$GUI_CHECKED) Then $sys &= "; #INTERNAL_USE_ONLY# ==========================================================================================================="&@CRLF $sys &= "; ==============================================================================================================================="&@CRLF&@CRLF EndIf EndIf If BitAND(GUICtrlRead($UDF_SingleF), $GUI_CHECKED) = $GUI_CHECKED Or BitAND(GUICtrlRead($UDF_MultiF), $GUI_CHECKED) = $GUI_CHECKED Then $sys &= "; #FUNCTION# ===================================================================================================================="&@CRLF $sys &= "; Name...........: "&@CRLF $sys &= "; Description ...: "&@CRLF $sys &= "; Syntax.........: "&@CRLF $sys &= "; Parameters ....: "&@CRLF $sys &= "; Return values .: "&@CRLF $sys &= "; Author ........: "&GUICtrlRead($author)&@CRLF $sys &= "; Modified.......: "&@CRLF $sys &= "; Remarks .......: "&@CRLF $sys &= "; Related .......: "&@CRLF $sys &= "; Link ..........: "&@CRLF $sys &= "; Example .......: "&@CRLF $sys &= "; ==============================================================================================================================="&@CRLF&@CRLF EndIf If BitAND(GUICtrlRead($UDF_MultiF), $GUI_CHECKED) = $GUI_CHECKED Then $sys &= "; #INTERNAL_USE_ONLY# ==========================================================================================================="&@CRLF $sys &= "; Name...........: "&@CRLF $sys &= "; Description ...: "&@CRLF $sys &= "; Fields ........: "&@CRLF $sys &= "; Author ........: "&GUICtrlRead($author)&@CRLF $sys &= "; Remarks .......: "&@CRLF $sys &= "; ==============================================================================================================================="&@CRLF&@CRLF EndIf ; Write to file FileWriteLine($file,@CRLF&$sys) EndFunc #EndRegion ;UDF #Region ;GUI Func GenerateSingleGuiGlobal($file) Local $sys = "" $sys &= "; Initialize GUI"&@CRLF $sys &= "Global $hGUI = " & GenerateGuiCreateCode()&@CRLF $sys &= "GuiSetState(@SW_SHOW,$hGUI)"&@CRLF&@CRLF $sys &= "; Process GUI Commands"&@CRLF $sys &= "ProcessGuiCommands()"&@CRLF $sys &= "Func ProcessGuiCommands()"&@CRLF $sys &= " local $iMsg"&@CRLF $sys &= " While 1"&@CRLF $sys &= " $iMsg = GuiGetMsg()"&@CRLF $sys &= " Switch $iMsg"&@CRLF $sys &= " Case $GUI_EVENT_CLOSE"&@CRLF $sys &= " Exit"&@CRLF $sys &= " EndSwitch"&@CRLF $sys &= " Sleep(15)"&@CRLF $sys &= " Wend"&@CRLF $sys &= "EndFunc"&@CRLF ; Write to File FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateSingleGuiCapsule($file) Local $sys = "" $sys &= "ProcessGuiCommands()"&@CRLF $sys &= "Func ProcessGuiCommands()"&@CRLF $sys &= " ; Initialize GUI"&@CRLF $sys &= " Global $hGUI = " & GenerateGuiCreateCode()&@CRLF $sys &= " GuiSetState(@SW_SHOW,$hGUI)"&@CRLF&@CRLF $sys &= " ; Process GUI Commands"&@CRLF $sys &= " local $iMsg"&@CRLF $sys &= " While 1"&@CRLF $sys &= " $iMsg = GuiGetMsg()"&@CRLF $sys &= " Switch $iMsg"&@CRLF $sys &= " Case $GUI_EVENT_CLOSE"&@CRLF $sys &= " Exit"&@CRLF $sys &= " EndSwitch"&@CRLF $sys &= " Sleep(15)"&@CRLF $sys &= " Wend"&@CRLF $sys &= "EndFunc"&@CRLF ; Write to File FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateMultiGuiDynamic($file) Local $sys = "" $sys &= "; Stores the windows and message callbacks"&@CRLF $sys &= "Global $_Windows[1][2]"&@CRLF&@CRLF $sys &= "; Startup the Application"&@CRLF $sys &= "WinInitialize()"&@CRLF&@CRLF $sys &= "; ==========================================================="&@CRLF $sys &= "; Create the Primary Application Window"&@CRLF $sys &= "; ==========================================================="&@CRLF $sys &= "Func WinInitialize()"&@CRLF $sys &= " $_Windows[0][0] = "&GenerateGuiCreateCode()&@CRLF $sys &= " GUISetState(@SW_SHOW,$_Windows[0][0])"&@CRLF $sys &= " $_Windows[0][1] = 'HandleWinowMessages'"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF $sys &= "; ==========================================================="&@CRLF $sys &= "; Message Callback for the Primary Application Window"&@CRLF $sys &= "; ==========================================================="&@CRLF $sys &= "Func HandleWinowMessages($msg)"&@CRLF $sys &= " Switch $msg[0]"&@CRLF $sys &= " Case $GUI_EVENT_CLOSE"&@CRLF $sys &= " Exit"&@CRLF $sys &= " EndSwitch"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF $sys &= "; ==========================================================="&@CRLF $sys &= "; Call this to register a new window"&@CRLF $sys &= "; ==========================================================="&@CRLF $sys &= "Func _WinRegister($handle,$callback)"&@CRLF $sys &= " ReDim $_Windows[UBound($_Windows)+1][2]"&@CRLF $sys &= " $_Windows[UBound($_Windows)-1][0] = $handle"&@CRLF $sys &= " $_Windows[UBound($_Windows)-1][1] = $callback"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF $sys &= "; ==========================================================="&@CRLF $sys &= "; Call this to unregister a window"&@CRLF $sys &= "; ==========================================================="&@CRLF $sys &= "Func _WinUnregister($handle)"&@CRLF $sys &= " Local $found = False"&@CRLF $sys &= " For $i=0 To UBound($_Windows)-2"&@CRLF $sys &= " If $handle == $_Windows[$i][0] Then"&@CRLF $sys &= " $found = True"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " If $found == True Then"&@CRLF $sys &= " $_Windows[$i][0] = $_Windows[$i+1][0]"&@CRLF $sys &= " $_Windows[$i][1] = $_Windows[$i+1][1]"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Next"&@CRLF $sys &= " If $found = True Then"&@CRLF $sys &= " ReDim $_Windows[UBound($_Windows)-1][2]"&@CRLF $sys &= " EndIf"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF $sys &= "; ==========================================================="&@CRLF $sys &= "; Main loop for processing all messages"&@CRLF $sys &= "; ==========================================================="&@CRLF $sys &= "Func _WinLoop()"&@CRLF $sys &= " Local $msg"&@CRLF $sys &= " GUISetState(@SW_SHOW,$_Windows[0][0])"&@CRLF $sys &= " While 1"&@CRLF $sys &= " Sleep(15)"&@CRLF $sys &= " $msg = GUIGetMsg(1)"&@CRLF $sys &= " If $msg[0] == $GUI_EVENT_MOUSEMOVE Then"&@CRLF $sys &= " ContinueLoop"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " For $i=0 To UBound($_Windows)-1"&@CRLF $sys &= " If $msg[1]==$_Windows[$i][0] Then"&@CRLF $sys &= " Execute($_Windows[$i][1]&'($msg)')"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " Next"&@CRLF $sys &= " WEnd"&@CRLF $sys &= "EndFunc"&@CRLF ; Write to File FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateOnEventGui($file) Local $sys = "Opt('GUIOnEventMode',1)"&@CRLF&@CRLF $sys &= "Global $hGUI = "&GenerateGuiCreateCode()&@CRLF $sys &= "GUISetState(@SW_SHOW,$hGUI)"&@CRLF $sys &= "GUISetOnEvent($GUI_EVENT_CLOSE,'Close',$hGUI)"&@CRLF&@CRLF $sys &= "; Just idle around"&@CRLF $sys &= "While 1"&@CRLF $sys &= " Sleep(10000)"&@CRLF $sys &= "WEnd"&@CRLF&@CRLF $sys &= "Func Close()"&@CRLF $sys &= " Exit"&@CRLF $sys &= "EndFunc"&@CRLF ; Write to File FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateRomeGui($file) Local $ac = StringLeft(StringReplace(GUICtrlRead($name)," ",""),3) Local $sys = "; -------------------------------------------------------"&@CRLF $sys &= "; "&GUICtrlRead($name)&@CRLF $sys &= "; -------------------------------------------------------"&@CRLF&@CRLF $sys &= "; GUI and Control variable predeclerations"&@CRLF $sys &= "Global $"&$ac&"_GUI"&@CRLF $sys &= "; Used in preventing multiple instances"&@CRLF $sys &= "Global $"&$ac&"_Active=False"&@CRLF&@CRLF $sys &= "; -------------------------------------------------------"&@CRLF $sys &= "; Initialization Routine"&@CRLF $sys &= "; -------------------------------------------------------"&@CRLF $sys &= "Func "&$ac&"_Initialize()"&@CRLF $sys &= " ; Prevent multiple instances"&@CRLF $sys &= " If $"&$ac&"_Active==True Then"&@CRLF $sys &= " Return"&@CRLF $sys &= " EndIf"&@CRLF $sys &= " $"&$ac&"_Active = True"&@CRLF $sys &= " "&@CRLF $sys &= " ; Create and register the GUI"&@CRLF $sys &= " $"&$ac&"_GUI = "&GenerateGuiCreateCode()&@CRLF $sys &= " GUISetState(@SW_SHOW,$"&$ac&"_GUI)"&@CRLF&" "&@CRLF $sys &= " _ROME_WinRegister($"&$ac&"_GUI,'"&$ac&"_Process')"&@CRLF $sys &= "EndFunc"&@CRLF $sys &= "Func "&$ac&"_InitEntry($DynamicCategory)"&@CRLF $sys &= " _ROME_TreeAddItem('"&GUICtrlRead($name)&"',$ROME_Timg_Star,$DynamicCategory,'"&$ac&"_Initialize()')"&@CRLF $sys &= "EndFunc"&@CRLF&@CRLF $sys &= "; --------------------------------------------------"&@CRLF $sys &= "; Message Callback"&@CRLF $sys &= "; -------------------------------------------------------"&@CRLF $sys &= "Func "&$ac&"_Process($msg)"&@CRLF $sys &= " Switch $msg[0]"&@CRLF $sys &= " Case $GUI_EVENT_CLOSE"&@CRLF $sys &= " GUIDelete($"&$ac&"_GUI)"&@CRLF $sys &= " _ROME_WinUnregister($"&$ac&"_GUI)"&@CRLF $sys &= " EndSwitch"&@CRLF $sys &= "EndFunc"&@CRLF ; Write to File FileWriteLine($file,@CRLF&$sys) EndFunc Func GenerateGuiCreateCode() Switch GUICtrlRead($GUI_Type) Case "Borderless" Return "GuiCreate('"&GUICtrlRead($GUI_Title)&"',"&GUICtrlRead($GUI_X)&","&GUICtrlRead($GUI_Y)&",Default,Default,$WS_POPUP)" Case "Toolwindow" Return "GuiCreate('"&GUICtrlRead($GUI_Title)&"',"&GUICtrlRead($GUI_X)&","&GUICtrlRead($GUI_Y)&",Default,Default,Default,$WS_EX_TOOLWINDOW)" EndSwitch Return "GuiCreate('"&GUICtrlRead($GUI_Title)&"',"&GUICtrlRead($GUI_X)&","&GUICtrlRead($GUI_Y)&")" EndFunc #EndRegion ;GUI Edited February 16, 2010 by NerdFencer _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
storme Posted February 11, 2010 Share Posted February 11, 2010 Hay great work. We need something like it included in SciTE so that we can get some standard headers on scripts. One suggestion. Save settings, such as Author so it doesn't have to be retyped. Also woudl be good to add a "Save in" folder instead of just dumping it in teh saem folder as the script. John Morrison Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
NerdFencer Posted February 11, 2010 Author Share Posted February 11, 2010 (edited) Updated to v0.2 with both suggestions implemented. Thanks for the feedback! Any more? Edited February 11, 2010 by NerdFencer _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
Sunaj Posted February 12, 2010 Share Posted February 12, 2010 (edited) Yes, first of all, this is brilliant and should def be included in SciTE for minimizing repetitive tasks! Secondarily, would really like to see OnEventModes (both GUI and TRAY) implemented as well; this would make Shell Program Creator feature-complete, at least from my perspective;)!Updated to v0.2 with both suggestions implemented.Thanks for the feedback!Any more? Edited February 12, 2010 by Sunaj [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
storme Posted February 12, 2010 Share Posted February 12, 2010 What about adding a SciTE installer so that this could be added/removed as a Tool for SciTE. John Morrison AKA Storm-E Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
NerdFencer Posted February 15, 2010 Author Share Posted February 15, 2010 Updated to v0.3 I cant seem to figure out how to add it to the Tools menu in Scite yet... If anybody knows please tell me so I can put it in the next release _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
Sunaj Posted February 15, 2010 Share Posted February 15, 2010 Thumbs up! Updated to v0.3I cant seem to figure out how to add it to the Tools menu in Scite yet...If anybody knows please tell me so I can put it in the next release [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
Sunaj Posted February 15, 2010 Share Posted February 15, 2010 Also.. I cant seem to figure out how to add it to the Tools menu in Scite yet... If anybody knows please tell me so I can put it in the next release Try and have a look at this code snippet from an defunct project I had going at some point; the SciTE installer in my project worked just fine.. (hope you can work around the idiosyncrasies of it - at least it tells you the format of the data to add and the place where to add the them Func Install() $old_result = "" For $i = 5 To 45 ; assuming there'll be no less than 5 menu items and no more than 45 in the SciTE AU3 Tools menu $result = StringInStr($File_au3_properties,"command." & $i & ".$") If $result == 0 Then $string_to_append = @CRLF & @CRLF & "#x " & $i & " FuncHighlight, add highlight and calltips" & @CRLF & _ "command.name." & $i & ".$(au3)=FuncHighlight, add highlight and calltips" & @CRLF & _ "command.shortcut." & $i & ".$(au3)=Ctrl+Shift+C" & @CRLF & _ 'command.' & $i & '.$(au3)="' & StringReplace(@ScriptFullPath,".au3",".exe") & '"' & ' "$(FilePath)"' $file_handle = FileOpen($Au3_install_dir & "\SciTE\Properties\au3.properties",1) $test = FileWrite($file_handle,$string_to_append) If $test == 1 Then MsgBox(48,"FuncHighlighter installed","Success, after restarting SciTE you can invoke via Tools menu") EndIf FileClose($file_handle) ExitLoop EndIf Next EndFunc [list=1][*]Generic way to detect full path to default browser, List/ListView Events Using GuiRegisterMsg (detect doubleclick and much more)[*]Using dllcall for full control over fileopendialog, Make DirMove act somewhat normally (by circumventing it...)[*]Avoid problems with "&" (chr(38)) in code, Change desktop maximized area/workspace (fx to make deskbar type app)[*]Change focus behavior when buttons are clicked to work closer to 'standard windows' app[*](Context) Menus With Timed Tooltips, Fast Loops & Operators in AU3[*]Clipboard UDF, A clipboard change notification udf[/list] Link to comment Share on other sites More sharing options...
NerdFencer Posted February 16, 2010 Author Share Posted February 16, 2010 Updated to v0.4 @Sunaj Thanks! I added a /Install param to this release Also, Tray stuff (including on event) has been added _________[u]UDFs[/u]_________-Mouse UDF-Math UDF-Misc Constants-Uninstaller Shell Link to comment Share on other sites More sharing options...
storme Posted February 17, 2010 Share Posted February 17, 2010 Updated to v0.4@SunajThanks!I added a /Install param to this releaseAlso, Tray stuff (including on event) has been addedLooking real good mateThe only suggestion I can think of now is to add "tips" to all the check boxes (etc) as a reminder what the options do.Well doneJohnakaStorm-E Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
MilesAhead Posted March 1, 2010 Share Posted March 1, 2010 (edited) Looks interesting. I'm a version behind in AutoIt3 (3.3.0.0). When I run the script with /Install param, I get the gui but I don't see anything in Scite. Is it specific to latest AutoIt3 setup or something? I'd love to have a code wizard in the tools menu for sure. edit: nevermind. Got it. Thanks for the tool! Edited March 1, 2010 by MilesAhead My Freeware Page Link to comment Share on other sites More sharing options...
MilesAhead Posted March 3, 2010 Share Posted March 3, 2010 btw I haven't had as good a luck on Windows 7 with the latest AutoIt3. It shows in the Tool menu in Scite if I have an .au3 file already loaded, but not otherwise. Also when I hit the Generate button, say for a Tray app.. instead of generating source and loading in the editor, it runs it in the tray. I get an icon with an Exit command and that's it. I just installed AutoIt3 3.3.4.0, installed the Scite4AutoIt3 package, then Shell Program Creator. It worked fine on Vista64 with AutoIt3 3.3.0.0 installed. My Freeware Page 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