grtech Posted January 28, 2012 Share Posted January 28, 2012 (edited) #############EDITING COMPLETED AND GUI NOW WORKING############## -----------------------I have updated attachment with working gui---------------------------- ---Extract to C:\ and then goto "C:\AutoInstallPicker\test\NEEDS TO BE DONE.txt"--- ################################################################## Hi Guys been a long time since i last posted but i have stumped myself once again haha the point i am trying to get to is were i have a multi tabbed gui with checkboxes on which i can randumly check to install software (it would be easy if i wasnt trying to put a twist in and have different installation paths for the same software depending on what office you are in), also if you dont have the office selected it wont run and give you and error(This part i have), the part i am trying to get is a simple way to check to see if there is none of the checked boxes ticked to give an error. the very basics of it is, if no office selected gives an error even if boxes are ticked or not and when the office is selected and no boxes selected gives another error, also when the boxes are selected it goes to the office location to run the cmd files. (with most of these files been manual installs at the moment it will bring up a msgbox to click once the install is completed for it to continue onto the next selection). i have attached a zip with the main structure in, at the moment there is only "testing" office that is configured and checkboxes "SAPA" and "Sage Line 50 v 2012". any help would be appreciated.AutoInstallPicker.zip Edited February 4, 2012 by grtech Link to comment Share on other sites More sharing options...
grtech Posted January 29, 2012 Author Share Posted January 29, 2012 (edited) Hey guys, after lookin at this with fresh eyes haha, i have noticed the error of my ways.stupid and easy to do.now the bit extra i am wondering if possible, just trying to cut amount of code down, say it reads the office then runs the office names software location and the software name like this bit of script that i have, but with this i am going to have to script for every software and every office, example ($office&$software)Office selecting a selection of &testing $sund $leed and the software from a selection of $sapa $line50.i think i know that i am going to have to create each checkboxstatus to software but the main thing is the officeIf GUICtrlRead($Office) = "testing" and $CheckBoxStatus1 = $GUI_CHECKED Then run($testsoftware&$SAPAPATH) MsgBox(0, "SAPA Installing", "Click OK once SAPA has completed installation") WinWaitClose("SAPA Installing","Click OK once SAPA has completed installation") ElseIf $CheckBoxStatus1 = $GUI_UncheckeD Then ;MsgBox(0, "checkbox 1", "Checkbox 1 is unchecked") EndIf ; End If/ElseIf statement for checkbox1Here is the full script below #EndRegion ### END Koda GUI section ### of the file within the zip in first post.expandcollapse popupWhile 1 $GuiMsg = GuiGetMsg() Select Case $GuiMsg = $Gui_Event_Close Exit Case $GuiMsg = $Button1 ;START OF CHECKING THE CHECK BOXES $CheckBoxStatus1 = GuiCtrlRead($CheckBox1) $CheckBoxStatus2 = GuiCtrlRead($CheckBox2) $CheckBoxStatus3 = GuiCtrlRead($CheckBox3) ;OFFICE SELECTION ;NO OFFICE If GUICtrlRead($Office) = "Please select your office" Then msgbox(16,"Choose Office","You have not selected an Office") ElseIf GUICtrlRead($Office) = "Please select your office" Then EndIf ;NO SOFTWARE If $Checkboxstatus1 = $GUI_UNCHECKED And $Checkboxstatus2 = $GUI_UNCHECKED And $Checkboxstatus3 = $GUI_UNCHECKED And GUICtrlRead ($Office) <> "Please select your office" Then MsgBox(16, "No Software", "No Applications installs selected") ElseIf $CheckBoxStatus1 = $GUI_CHECKED Then ;MsgBox(0, "checkbox 1", "Checkbox 1 is unchecked") EndIf ; End If/ElseIf statement for checkbox1 ;TESTING If GUICtrlRead($Office) = "testing" and $CheckBoxStatus1 = $GUI_CHECKED Then run($testsoftware&$SAPAPATH) MsgBox(0, "SAPA Installing", "Click OK once SAPA has completed installation") WinWaitClose("SAPA Installing","Click OK once SAPA has completed installation") ElseIf $CheckBoxStatus1 = $GUI_UncheckeD Then ;MsgBox(0, "checkbox 1", "Checkbox 1 is unchecked") EndIf ; End If/ElseIf statement for checkbox1 ; If GUICtrlRead($Office) <> "Please select your office" and $CheckBoxStatus2 = $GUI_CHECKED Then run($testsoftware&$Line50v2012Path) MsgBox(0, "Line50 Installing", "Click OK once Line50 has completed installation") WinWaitClose("Line50 Installing","Click OK once Line50 has completed installation") ElseIf $CheckBoxStatus2 = $GUI_UncheckeD Then ;MsgBox(0, "checkbox 2", "Checkbox 2 is unchecked") Else EndIf ; End If/ElseIf statement for checkbox2 If GUICtrlRead($Office) <> "Please select your office" and $CheckBoxStatus3 = $GUI_CHECKED Then run($testsoftware&$DigitaAccounts) MsgBox(0, "Line50 Installing", "Click OK once Digita Accounts has completed installation") ElseIf $CheckBoxStatus2 = $GUI_UncheckeD Then ;MsgBox(0, "checkbox 3", "Checkbox 3 is unchecked") Else EndIf ; End If/ElseIf statement for checkbox2 ;End of Checkbox Checking Case $GuiMsg = $Button2 Exit EndSelect WEnd Edited January 29, 2012 by grtech Link to comment Share on other sites More sharing options...
grtech Posted February 2, 2012 Author Share Posted February 2, 2012 anyone got any ideas Link to comment Share on other sites More sharing options...
Mikeman27294 Posted February 2, 2012 Share Posted February 2, 2012 Ok, here is the script, with cut-downs on the amount of lines, and also with less user input requirements. Firstly, the msgbox function pauses the script. Therefore, winwaitclose is not required. Secondly, RunWait will pause the script until the file which has been run, is exited. Thirdly, I have changed from a switch statement to a select statement. This allows you to test the entire switch statement against a value, rather than using a select value, and testing everything against this value. I have removed the $GuiMsg variable, and also, if you note the 3rd line, it tests the GUIMsg against both $GUI_EVENT_CLOSE and $Button2. If either of these are true then the program will exit. I have also removed any elseif statements where they contain commented msgbox functions. While 1 Switch GuiGetMsg() Case $Gui_Event_Close, $Button2 Exit Case $Button1 ;START OF CHECKING THE CHECK BOXES $CheckBoxStatus1 = GuiCtrlRead($CheckBox1) $CheckBoxStatus2 = GuiCtrlRead($CheckBox2) $CheckBoxStatus3 = GuiCtrlRead($CheckBox3) ;NO OFFICE If GUICtrlRead($Office) = "Please select your office" Then msgbox(16,"Choose Office","You have not selected an Office") EndIf ;NO SOFTWARE If $Checkboxstatus1 = $GUI_UNCHECKED And $Checkboxstatus2 = $GUI_UNCHECKED And $Checkboxstatus3 = $GUI_UNCHECKED And GUICtrlRead ($Office) <> "Please select your office" Then MsgBox(16, "No Software", "No Applications installs selected") EndIf ; End If statement for checkbox1 ;TESTING If GUICtrlRead($Office) = "testing" and $CheckBoxStatus1 = $GUI_CHECKED Then RunWait($testsoftware&$SAPAPATH) EndIf ; End If statement for checkbox1 If GUICtrlRead($Office) <> "Please select your office" and $CheckBoxStatus2 = $GUI_CHECKED Then RunWait($testsoftware&$Line50v2012Path) EndIf ; End If statement for checkbox2 If GUICtrlRead($Office) <> "Please select your office" and $CheckBoxStatus3 = $GUI_CHECKED Then RunWait($testsoftware&$DigitaAccounts) EndIf ; End If statement for checkbox3 ;End of Checkbox Checking EndSelect WEnd I hope this works well for you. Link to comment Share on other sites More sharing options...
grtech Posted February 4, 2012 Author Share Posted February 4, 2012 sorry just testing this and it does not start due to the switch not having an end and the end select not having a start, also this looks like a previous attempt that i tried myself, the reason i put the winwaitcloses in is that this will be running several cmd files due to the type of software it relates to which is always changing, so instead of putting the software in here to be edited only by me, other people can edit the cmd files for the new paths and files.Also if i put something along the lines of Case $Gui_Event_Close, $Button2 it doesn't run and if i put in my version Case $GuiMSG = $Gui_Event_Close or $guimsg = $Button2 then if it closes if the msgbox for selecting software or office message appears.but i must thank you for reminding me to remove the else if's, that was a failed attempt on my part and i just commented to remove them without removing them.the main thing i am now looking for is a way to have me to put 5 lines in for each check box instead of 5 lines for each checkbox and office just to cut the amount of script by 50%, there is possibly around 40+ offices and 40+ softwareexample -If GUICtrlRead($Office) = "#####Officename#####" and $CheckBoxStatus1 = $GUI_CHECKED Then run(#####officenames software location ##### & $SAPAPATH) MsgBox(0, "SAPA Installing", "Click OK once SAPA has completed installation") WinWaitClose("SAPA Installing","Click OK once SAPA has completed installation") EndIf Link to comment Share on other sites More sharing options...
grtech Posted February 4, 2012 Author Share Posted February 4, 2012 (edited) nice one, thanks to Mikeman27294 for reminding me about the select statement. all i needed was to do with this is really simple hahaha as soon as i read you had changed it to a select statement in Mikemans post it all fit into place. all i needed to do was stick the select statements in........... so code of Select case GUICtrlRead($Office) = "Please select your office" msgbox(16,"Choose Office","You have not selected an Office") ; display the value case GUICtrlRead($Office) = "Wakefield" $OfficeSelect=$WAKE case GUICtrlRead($Office) = "Leeds" $OfficeSelect=$LEED case GUICtrlRead($Office) = "Sunderland" $OfficeSelect=$SUND case GUICtrlRead($office) = "testing" $OfficeSelect=$testing EndSelect and some other amendements and bingo I have edited for public viewing and uploaded the full version to the main post Edited February 4, 2012 by grtech 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