TSO Posted March 18, 2008 Posted March 18, 2008 I'm trying to put together a GUI menu to add to a DVD full of about 15 different pieces of software. What I'd like is to have a menu where I can check boxes for the desired software I'd like to install (out of the 15 on-disc), and after I've selected the desired software to have the installations run consecutively (one after another) until they have all finished. Most of the installations are already configured to be non-interactive, but there are a few that require interaction (a few clicks at most). Aside from the 1 VB class I took in college and scripting crap in mIRC, I don't have the experience to tackle this, but any suggestions from the experts here would be 'greatly' appreciated. Or perhaps there is some kind of script already put together for this I could be directed to. Thanks again for the help guys
TSO Posted March 18, 2008 Author Posted March 18, 2008 Just want to add that thanks to this site I've found Koda, which seems to be a huge help so far. The "Choices Dialog" template they have is perfect for what I'm trying to accomplish. I could still use a whole lot of help as far as scripting the install .exe's to run in sequence though, and inputting a command or two for the few apps that require input. AutoIt kicks the crap out of ScriptIt though
covaks Posted March 18, 2008 Posted March 18, 2008 That shouldn't be that hard. Any problems you encounter you can come here and ask for help. But you'll need to have some code to show us. Look in the help, RunWait might be of use to you. Look at the WinWaitActive type functions as well. You can use them to pause your script until certain installer windows pop up. Then use Control functions (ControlClick, ControlSend, etc.) to enter in any information, or click any Next/Ok/Finish buttons.
TSO Posted March 18, 2008 Author Posted March 18, 2008 (edited) That shouldn't be that hard. Any problems you encounter you can come here and ask for help. But you'll need to have some code to show us. Look in the help, RunWait might be of use to you. Look at the WinWaitActive type functions as well. You can use them to pause your script until certain installer windows pop up. Then use Control functions (ControlClick, ControlSend, etc.) to enter in any information, or click any Next/Ok/Finish buttons.Yeah, was just about to paste what I have so far in so you can get an idea of what I'm trying to do.. Here's what I have so far. As I said, I'm pretty clueless.. Thanks to Koda I can resize and change lots of GUI options with ease, etc. From here I still have no idea how to program the buttons to do what I want, or how to script the installs, etc... Perhaps if someone could post back an edited script with a few of the changes for me, I can look at the code and figure out how to do the rest. Here's what I have so far... Thanks again for the help guys #include <GUIConstants.au3>#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Steve-O\Desktop\ModernMenuLib_with_Tray\tests\MasterSW2.kxf$Form2 = GUICreate("Master Software 2.0", 353, 363, 469, 307)GUISetIcon("D:\007.ico")GUISetBkColor(0x000080)$ListBox1 = GUICtrlCreateList("", 8, 8, 137, 292)GUICtrlSetData(-1, "Adobe Acrobat 8 Std.|Adobe Acrobat 8 Pro.|ActiveX Controls|Microsoft Project 2003 Std.|Microsoft Project 2003 Pro.|Microsoft Visio 2003 Std.|Microsoft Visio 2003 Pro.|SAP v4.6|DOORS|Microsoft Office 2003 Pro.")$Button1 = GUICtrlCreateButton(">", 156, 15, 30, 25, 0)$Button2 = GUICtrlCreateButton(">>", 156, 48, 31, 25, 0)$Button3 = GUICtrlCreateButton("<", 157, 81, 31, 25, 0)GUICtrlSetState(-1, $GUI_DISABLE)$Button4 = GUICtrlCreateButton("<<", 157, 114, 32, 25, 0)$ListBox2 = GUICtrlCreateList("", 200, 8, 137, 292)GUICtrlSetBkColor(-1, 0xC0C0C0)$Button5 = GUICtrlCreateButton("&Install", 231, 325, 75, 25, 0)GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")$Button6 = GUICtrlCreateButton("&Cancel", 41, 325, 75, 25, 0)GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ###While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitchWEnd Edited March 18, 2008 by TSO
covaks Posted March 18, 2008 Posted March 18, 2008 (edited) Here's something to get you started. I've added some lines to move items from one side to the other. You'll need to examine it to figure out how to move them back. It might look kind of complicated because the _GuiCtrlListBox_blahblah functions are so long in name, but it's really not. Just look at the functions in the help to see how they work. expandcollapse popup#include <GUIConstants.au3> #Include <GuiListBox.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Steve-O\Desktop\ModernMenuLib_with_Tray\tests\MasterSW2.kxf $Form2 = GUICreate("Master Software 2.0", 353, 363, 469, 307) GUISetIcon("D:\007.ico") GUISetBkColor(0x000080) $ListBox1 = GUICtrlCreateList("", 8, 8, 137, 292) GUICtrlSetData(-1, "Adobe Acrobat 8 Std.|Adobe Acrobat 8 Pro.|ActiveX Controls|Microsoft Project 2003 Std.|Microsoft Project 2003 Pro.|Microsoft Visio 2003 Std.|Microsoft Visio 2003 Pro.|SAP v4.6|DOORS|Microsoft Office 2003 Pro.") $Button1 = GUICtrlCreateButton(">", 156, 15, 30, 25, 0) $Button2 = GUICtrlCreateButton(">>", 156, 48, 31, 25, 0) $Button3 = GUICtrlCreateButton("<", 157, 81, 31, 25, 0) GUICtrlSetState(-1, $GUI_DISABLE) $Button4 = GUICtrlCreateButton("<<", 157, 114, 32, 25, 0) $ListBox2 = GUICtrlCreateList("", 200, 8, 137, 292) GUICtrlSetBkColor(-1, 0xC0C0C0) $Button5 = GUICtrlCreateButton("&Install", 231, 325, 75, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button6 = GUICtrlCreateButton("&Cancel", 41, 325, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button6 Exit Case $Button1 ; Make sure something is selected before going any further. If _GUICtrlListBox_GetCurSel($ListBox1) >= 0 Then ; Check to see if the item is there yet or not. Only add it if it's not currently in the listbox, so items are only added once. If _GUICtrlListBox_FindString($ListBox2,_GUICtrlListBox_GetText($ListBox1, _GUICtrlListBox_GetCurSel($Listbox1))) = -1 Then ; Item is not there yet, so lets add it _GuiCtrlListBox_AddString($Listbox2,_GUICtrlListBox_GetText($ListBox1, _GUICtrlListBox_GetCurSel($Listbox1))) EndIf EndIf Case $Button2 $ItemCount = _GUICtrlListBox_GetCount($ListBox1) ; Go through each item in the first listbox and add it to the second listbox For $x = 0 to $ItemCount - 1 ; But first, lets check to make sure we are only adding items that are not already there If _GUICtrlListBox_FindString($ListBox2,_GUICtrlListBox_GetText($ListBox1, $x)) = -1 Then _GuiCtrlListBox_AddString($Listbox2,_GUICtrlListBox_GetText($ListBox1, $x)) EndIf Next Case $Button5 ; Maybe call a seperate function here to start installing items Install() EndSwitch WEnd Func Install() For $x = 0 to _GUICtrlListBox_GetCount($ListBox2) - 1 Switch _GUICtrlListBox_GetText($ListBox2, $x) Case "SAP v4.6" ;Run("SAP installer..") Case "Microsoft Project 2003 Pro." ;Run("Microsoft Project installer..") ;WinWaitActive("Some installer window") ;ControlClick("active","","ok button control") ; etc etc. EndSwitch Next EndFunc Edited March 18, 2008 by covaks
TSO Posted March 18, 2008 Author Posted March 18, 2008 Here's something to get you started. I've added some lines to move items from one side to the other. You'll need to examine it to figure out how to move them back. It might look kind of complicated because the _GuiCtrlListBox_blahblah functions are so long in name, but it's really not. Just look at the functions in the help to see how they work. expandcollapse popup#include <GUIConstants.au3> #Include <GuiListBox.au3> #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Steve-O\Desktop\ModernMenuLib_with_Tray\tests\MasterSW2.kxf $Form2 = GUICreate("Master Software 2.0", 353, 363, 469, 307) GUISetIcon("D:\007.ico") GUISetBkColor(0x000080) $ListBox1 = GUICtrlCreateList("", 8, 8, 137, 292) GUICtrlSetData(-1, "Adobe Acrobat 8 Std.|Adobe Acrobat 8 Pro.|ActiveX Controls|Microsoft Project 2003 Std.|Microsoft Project 2003 Pro.|Microsoft Visio 2003 Std.|Microsoft Visio 2003 Pro.|SAP v4.6|DOORS|Microsoft Office 2003 Pro.") $Button1 = GUICtrlCreateButton(">", 156, 15, 30, 25, 0) $Button2 = GUICtrlCreateButton(">>", 156, 48, 31, 25, 0) $Button3 = GUICtrlCreateButton("<", 157, 81, 31, 25, 0) GUICtrlSetState(-1, $GUI_DISABLE) $Button4 = GUICtrlCreateButton("<<", 157, 114, 32, 25, 0) $ListBox2 = GUICtrlCreateList("", 200, 8, 137, 292) GUICtrlSetBkColor(-1, 0xC0C0C0) $Button5 = GUICtrlCreateButton("&Install", 231, 325, 75, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button6 = GUICtrlCreateButton("&Cancel", 41, 325, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $Button6 Exit Case $Button1 ; Make sure something is selected before going any further. If _GUICtrlListBox_GetCurSel($ListBox1) >= 0 Then ; Check to see if the item is there yet or not. Only add it if it's not currently in the listbox, so items are only added once. If _GUICtrlListBox_FindString($ListBox2,_GUICtrlListBox_GetText($ListBox1, _GUICtrlListBox_GetCurSel($Listbox1))) = -1 Then ; Item is not there yet, so lets add it _GuiCtrlListBox_AddString($Listbox2,_GUICtrlListBox_GetText($ListBox1, _GUICtrlListBox_GetCurSel($Listbox1))) EndIf EndIf Case $Button2 $ItemCount = _GUICtrlListBox_GetCount($ListBox1) ; Go through each item in the first listbox and add it to the second listbox For $x = 0 to $ItemCount - 1 ; But first, lets check to make sure we are only adding items that are not already there If _GUICtrlListBox_FindString($ListBox2,_GUICtrlListBox_GetText($ListBox1, $x)) = -1 Then _GuiCtrlListBox_AddString($Listbox2,_GUICtrlListBox_GetText($ListBox1, $x)) EndIf Next Case $Button5 ; Maybe call a seperate function here to start installing items Install() EndSwitch WEnd Func Install() For $x = 0 to _GUICtrlListBox_GetCount($ListBox2) - 1 Switch _GUICtrlListBox_GetText($ListBox2, $x) Case "SAP v4.6" ;Run("SAP installer..") Case "Microsoft Project 2003 Pro." ;Run("Microsoft Project installer..") ;WinWaitActive("Some installer window") ;ControlClick("active","","ok button control") ; etc etc. EndSwitch Next EndFuncWill do; going to take a look at this later today. Thanks for the help mang
TSO Posted March 18, 2008 Author Posted March 18, 2008 By the way, I just realized I could probably benefit from writing this within some kind of debugger instead of wordpad. Does AutoIt have some kind of debugging editor I can use (this might be in a FAQ somewhere, so if it is, forgive me, I'm just working on a limited schedule here :-X)
TSO Posted March 18, 2008 Author Posted March 18, 2008 I tried this to test an install: Case "SAP v6.4" ;Run("SAP installer..") Run("SAP640.exe", "C:\tools\SOFTWARE\SAP64", @SW_MAXIMIZE) It returned an error: "Unable to execute external program" "Cannot find the file specified." I figured it was a syntax error, but when I try the same format with a little .exe I wrote that adds some registry entries, it ran fine. All the Windows app .exe's seem to return this error though. Any ideas? Thanks.
covaks Posted March 18, 2008 Posted March 18, 2008 use SciTE to write your AutoIT programs. It has all the goodies, you can get it HereTry this: Run("C:\tools\SOFTWARE\SAP64\SAP640.exe", "C:\tools\SOFTWARE\SAP64", @SW_MAXIMIZE)
TSO Posted March 19, 2008 Author Posted March 19, 2008 use SciTE to write your AutoIT programs. It has all the goodies, you can get it Here Try this: Run("C:\tools\SOFTWARE\SAP64\SAP640.exe", "C:\tools\SOFTWARE\SAP64", @SW_MAXIMIZE)Using the full path worked! Thanks I'll see if I can figure out RunWait and how to script the attended installs to run unintended on my own. Remind me to PayPal you some money after it's done just for saving me hours of fumbling
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