Wraith Posted April 28, 2007 Share Posted April 28, 2007 Hi there, I've been trying to make an install script for the computer repair company that I work for. I need it to have a list of check boxes that the user can click and then have the script run a different install script for each program the user wants installed. I've got the individual install scripts written and working, but I can't seem to get the menu to not run them all at the same time... Any help would be appreciated. Thanks, Wraith Link to comment Share on other sites More sharing options...
Wraith Posted April 28, 2007 Author Share Posted April 28, 2007 Since you posted no script I may be off for what you want but, Maybe look at select and case in the help file Sorry about not posting the script... here it is: expandcollapse popup#include <GUIConstants.au3> Opt("TrayIconHide", 1) GUICreate("Install Script Menu", 200, 250, 310, 190, $WS_POPUPWINDOW) GUISetIcon(@ScriptDir & "\Fajr.ico", -1) GUICtrlCreateLabel("Select your Applications: ", 10, 20) $opt1 = GUICtrlCreateCheckbox("JavaSE 5.0 update 6", 10, 50) $opt2 = GUICtrlCreateCheckbox("Spybot Search and Destroy", 10, 70) $opt3 = GUICtrlCreateCheckbox("Adobe Reader 8", 10, 90) $opt4 = GUICtrlCreateCheckbox("Everest Home Edition", 10, 110) $opt5 = GUICtrlCreateCheckbox("Option 5", 10, 130) $opt6 = GUICtrlCreateCheckbox("Option 6", 10, 150) $opt7 = GUICtrlCreateCheckbox("Option 7", 10, 170) $opt8 = GUICtrlCreateCheckbox("Option 8", 10, 190) $exit = GUICtrlCreateButton("Exit", 100, 220, 60) $Option = GUICtrlCreateButton("Excute", 10, 220, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $exit Exit Case $msg = $Option If GUICtrlRead($opt1) = 1 Then run("JavaSE RE 5.0 update 6 install.exe") EndIf If GUICtrlRead($opt2) = 1 Then run("Spybot Search and Destroy.exe") sleep(60000) EndIf If GUICtrlRead($opt3) = 1 Then run("Adobe Reader 8.exe") sleep(120000) EndIf If GUICtrlRead($opt4) = 1 Then run("Everest home edition.exe") sleep(180000) EndIf If GUICtrlRead($opt5) = 1 Then MsgBox(0, "", "opt 5 is checked") sleep(240000) EndIf If GUICtrlRead($opt6) = 1 Then MsgBox(0, "", "opt 6 is checked") sleep(300000) EndIf If GUICtrlRead($opt7) = 1 Then MsgBox(0, "", "opt 7 is checked") sleep(360000) EndIf If GUICtrlRead($opt8) = 1 Then MsgBox(0, "", "opt 8 is checked") sleep(390000) EndIf EndSelect WEnd I know the sleep commands shouldn't be there... I was just testing to see if that would work... Link to comment Share on other sites More sharing options...
Wraith Posted April 28, 2007 Author Share Posted April 28, 2007 Thanks! Link to comment Share on other sites More sharing options...
Wraith Posted April 29, 2007 Author Share Posted April 29, 2007 After doing some more research I found a slightly better way to do it... I used RunWait instead of Run("...") and ProcessWait. Just thought I'd mention it. Link to comment Share on other sites More sharing options...
MHz Posted April 29, 2007 Share Posted April 29, 2007 This may suit your cause. I made it for an autorun for software installations for a CD/DVD but is suitable to run from anywhere. You do not need to compile your install scripts and it will do as many as you want by using a treeview with checkboxes to hold all the entries. Have a look here. Link to comment Share on other sites More sharing options...
Wraith Posted April 29, 2007 Author Share Posted April 29, 2007 I'm still having some troubles with this one... Now it will only perform the first install... Here's the new code: expandcollapse popup#include <GUIConstants.au3> Opt("Trayicondebug",1) GUICreate("Install Script Menu", 200, 250, 310, 190, $WS_POPUPWINDOW) GUISetIcon(@ScriptDir & "\Fajr.ico", -1) GUICtrlCreateLabel("Select your Applications: ", 10, 20) $opt1 = GUICtrlCreateCheckbox("JavaSE 5.0 update 6", 10, 50) $opt2 = GUICtrlCreateCheckbox("Spybot Search and Destroy", 10, 70) $opt3 = GUICtrlCreateCheckbox("Adobe Reader 8", 10, 90) $opt4 = GUICtrlCreateCheckbox("Everest Home Edition", 10, 110) $opt5 = GUICtrlCreateCheckbox("Option 5", 10, 130) $opt6 = GUICtrlCreateCheckbox("Option 6", 10, 150) $opt7 = GUICtrlCreateCheckbox("Option 7", 10, 170) $opt8 = GUICtrlCreateCheckbox("Option 8", 10, 190) $exit = GUICtrlCreateButton("Exit", 100, 220, 60) $Option = GUICtrlCreateButton("Excute", 10, 220, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $exit Then Exit Elseif $msg = $Option Then Select Case GUICtrlRead($opt1) = 1 Run("JavaSE RE 5.0 update 6 install.exe") ProcessWaitClose("JavaSE RE 5.0 update 6 install.exe") Case GUICtrlRead($opt2) = 1 Run("Spybot Search and Destroy.exe") ProcessWaitClose("Spybot Search and Destroy.exe") Case GUICtrlRead($opt3) = 1 Run("Adobe Reader 8.exe") ProcessWaitClose("Adobe Reader 8.exe") Case GUICtrlRead($opt4) = 1 Run("Everest home edition.exe") ProcessWaitClose("Everest home edition.exe") Case GUICtrlRead($opt5) = 1 MsgBox(0, "", "opt 5 is checked") Case GUICtrlRead($opt6) = 1 MsgBox(0, "", "opt 6 is checked") Case GUICtrlRead($opt7) = 1 MsgBox(0, "", "opt 7 is checked") Case GUICtrlRead($opt8) = 1 MsgBox(0, "", "opt 8 is checked") EndSelect EndIf WEnd Maybe someone could tell me what I'm doing wrong? Link to comment Share on other sites More sharing options...
MHz Posted April 29, 2007 Share Posted April 29, 2007 Select...Case...EndSelect will only find the 1st true Case and will execute it. So you get only the 1 execution. This may help you. While 1 $msg = GUIGetMsg() If $msg = $exit Then Exit Elseif $msg = $Option Then If GUICtrlRead($opt1) = 1 Then Run("JavaSE RE 5.0 update 6 install.exe") ProcessWaitClose("JavaSE RE 5.0 update 6 install.exe") EndIf If GUICtrlRead($opt2) = 1 Then Run("Spybot Search and Destroy.exe") ProcessWaitClose("Spybot Search and Destroy.exe") EndIf If GUICtrlRead($opt3) = 1 Then Run("Adobe Reader 8.exe") ProcessWaitClose("Adobe Reader 8.exe") EndIf If GUICtrlRead($opt4) = 1 Then Run("Everest home edition.exe") ProcessWaitClose("Everest home edition.exe") EndIf If GUICtrlRead($opt5) = 1 Then MsgBox(0, "", "opt 5 is checked") EndIf If GUICtrlRead($opt6) = 1 Then MsgBox(0, "", "opt 6 is checked") EndIf If GUICtrlRead($opt7) = 1 Then MsgBox(0, "", "opt 7 is checked") EndIf If GUICtrlRead($opt8) = 1 Then MsgBox(0, "", "opt 8 is checked") EndIf EndIf WEnd Link to comment Share on other sites More sharing options...
Wraith Posted April 29, 2007 Author Share Posted April 29, 2007 Thats what I thought... Thanks for the help, you all rock! Link to comment Share on other sites More sharing options...
eltorro Posted May 1, 2007 Share Posted May 1, 2007 (edited) Here's a different approach: expandcollapse popup#include <GUIConstants.au3> Opt("Trayicondebug",1) Opt("RunErrorsFatal",0) ; so the script won't stop if one of the install progs is missing GUICreate("Install Script Menu", 200, 250, 310, 190, $WS_POPUPWINDOW) GUISetIcon(@ScriptDir & "\Fajr.ico", -1) GUICtrlCreateLabel("Select your Applications: ", 10, 20) Local $opt[8][2] $opt[0][0] = GUICtrlCreateCheckbox("JavaSE 5.0 update 6", 10, 50) $opt[0][1] = "JavaSE RE 5.0 update 6 install.exe" $opt[1][0] = GUICtrlCreateCheckbox("Spybot Search and Destroy", 10, 70) $opt[1][1] = "Spybot Search and Destroy.exe" $opt[2][0] = GUICtrlCreateCheckbox("Adobe Reader 8", 10, 90) $opt[2][1] = "Adobe Reader 8.exe" $opt[3][0] = GUICtrlCreateCheckbox("Everest Home Edition", 10, 110) $opt[3][1] = "Everest home edition.exe" $opt[4][0] = GUICtrlCreateCheckbox("Option 5", 10, 130) $opt[4][1] = "" $opt[5][0] = GUICtrlCreateCheckbox("Option 6", 10, 150) $opt[5][1] = "" $opt[6][0] = GUICtrlCreateCheckbox("Option 7", 10, 170) $opt[6][1] = "" $opt[7][0] = GUICtrlCreateCheckbox("Option 8", 10, 190) $opt[7][1] = "" $exit = GUICtrlCreateButton("Exit", 100, 220, 60) $option = GUICtrlCreateButton("Excute", 10, 220, 60) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $exit Then Exit Elseif $msg = $option Then Install($opt) EndIf sleep(15) WEnd Func Install($aOpt) For $x = 0 to UBound($aOpt,1)-1 If GuiCtrlRead($aOpt[$x][0]) = 1 Then If $aOpt[$x][1] <> "" Then Run($aOpt[$x][1]) ProcessWaitClose($aOpt[$x][1]) Else MsgBox(0, "", "opt "&$x+1&" is checked",30) EndIf EndIf Next EndFunc eltorro Edited May 1, 2007 by eltorro Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code 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