dwaltosz Posted April 14, 2015 Share Posted April 14, 2015 hey guys i am creating a Driver installer as my company has a lot of different computers and drivers are a pain to install anyways well i have anested loop and trying to exit the 2nd loop and go back to the main screen of my GUI but everything i try either dose not work or brakes it some how i tried a EXITLOOP and a button the button just stoped it form working and the exitloop just did nothing? any ideas on how i can exit the 2nd loop and still stay in the program to select other drivers? expandcollapse popup#RequireAdmin #include <WinAPIFiles.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc GUICreate("Driver loader", 500, 200) GUICtrlCreateTab(10, 10, 485, 185) Global $BT1 = GUICtrlCreateButton("Exit", 400, 150, 60) $G1 = GUICtrlCreateTabItem("HP 450G1") Global $chb1 = GUICtrlCreateRadio("LAN", 30, 30) Global $chb2 = GUICtrlCreateRadio("WiFi", 30, 50) Global $chb3 = GUICtrlCreateRadio("Chipset", 30, 70) Global $chb8 = GUICtrlCreateRadio("Media Card", 30, 90) Global $chb4 = GUICtrlCreateRadio("Video", 140, 35) Global $chb5 = GUICtrlCreateRadio("Rapid Storage Technology", 140, 55) Global $chb6 = GUICtrlCreateRadio("3D DriveGuard", 140, 75) Global $chb7 = GUICtrlCreateRadio("USB3", 140, 95) $G2 = GUICtrlCreateTabItem("HP 450G2") GUISetState(@sw_show) While 1 Switch GUIGetMsg() case $chb2 IF _IsChecked($chb2) Then GUICreate("WiFi", 200, 200) Global $wifi1 = GUICtrlCreateRadio("Intel", 30, 30) Global $wifi2 = GUICtrlCreateRadio("Qualcomm", 30, 50) GUISetState(@sw_show) while 1 Switch GUIGetMsg() case $wifi1 If _IsChecked($wifi1) Then wifi11() EndIf case $wifi2 If _IsChecked($wifi2) Then wifi22() EndIf EndSwitch WEnd EndIf case $chb1 IF _IsChecked($chb1) Then If MsgBox(0, "Install", "To Install Nic Driver press OK") = 1 then lan() EndIf EndIf Case $BT1 ExitLoop EndSwitch WEnd Func wifi11() Run("O:\Drivers\HP\ProBook\450G1\WiFi - Intel\sp69971.exe") EndFunc Func wifi22() Run("O:\Drivers\HP\ProBook\450G1\WiFi - Qualcomm\sp64676.exe") EndFunc Func lan() Run("O:\Drivers\HP\ProBook\450G1\Lan\Install_Win7_7092_02252015\setup.exe") EndFunc Link to comment Share on other sites More sharing options...
MuffettsMan Posted April 14, 2015 Share Posted April 14, 2015 instead of using a while 1, make a conditional for the inner loop that drops once the condition is met for-instance i have a gui that pops up only while a certain count is taking place so that loop keeps continuing until $count < $defaultCount (which is called in one of my functions expandcollapse popupWhile $count < $defaultCount Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $defaultAction DefaultAction() $query = "select count(*) from action where default_check = 1"; $count = SQLiteCheck($query); See if we have an entry now ConsoleWrite("$count: " & $count & @CRLF) Case $defaultSchedule DefaultSchedule() $query = "select count(*) from schedule where default_check = 1"; $count = SQLiteCheck($query); See if we have an entry now ConsoleWrite("$count: " & $count & @CRLF) Case $defaultNotification DefaultNotification() $query = "select count(*) from notification where default_check = 1"; $count = SQLiteCheck($query); See if we have an entry now ConsoleWrite("$count: " & $count & " of " & $defaultCount & @CRLF) if $count = 1 Then MsgBox($MB_SYSTEMMODAL, "Information", "Last one... set a default error message and click 'Update Default Settings'.") ; assume we now need to set the default error message.... _GUICtrlComboBox_SetCurSel ( $Type, 1) ; set default choice EndIf Case $ActionWinFolder ActionWinFolder() Case $TabSheet If $afTabSheets[GUICtrlRead($TabSheet)] = False Then _Lock_Tab() EndIf EndSwitch sleep(10) WEnd Don't let that status fool you, I am no advanced memeber! Link to comment Share on other sites More sharing options...
MuffettsMan Posted April 14, 2015 Share Posted April 14, 2015 looking at your code i'd try spawning a second thread to run the exe files so it won't make your main gui hang Don't let that status fool you, I am no advanced memeber! Link to comment Share on other sites More sharing options...
MuffettsMan Posted April 14, 2015 Share Posted April 14, 2015 (edited) though now that i re-read it, do you want to just hide the sub gui when you are done? in the sub loop added: Case $GUI_EVENT_CLOSE GUISetState(@sw_hide) expandcollapse popup#RequireAdmin #include <WinAPIFiles.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc GUICreate("Driver loader", 500, 200) GUICtrlCreateTab(10, 10, 485, 185) Global $BT1 = GUICtrlCreateButton("Exit", 400, 150, 60) $G1 = GUICtrlCreateTabItem("HP 450G1") Global $chb1 = GUICtrlCreateRadio("LAN", 30, 30) Global $chb2 = GUICtrlCreateRadio("WiFi", 30, 50) Global $chb3 = GUICtrlCreateRadio("Chipset", 30, 70) Global $chb8 = GUICtrlCreateRadio("Media Card", 30, 90) Global $chb4 = GUICtrlCreateRadio("Video", 140, 35) Global $chb5 = GUICtrlCreateRadio("Rapid Storage Technology", 140, 55) Global $chb6 = GUICtrlCreateRadio("3D DriveGuard", 140, 75) Global $chb7 = GUICtrlCreateRadio("USB3", 140, 95) $G2 = GUICtrlCreateTabItem("HP 450G2") GUISetState(@sw_show) While 1 Switch GUIGetMsg() case $chb2 IF _IsChecked($chb2) Then GUICreate("WiFi", 200, 200) Global $wifi1 = GUICtrlCreateRadio("Intel", 30, 30) Global $wifi2 = GUICtrlCreateRadio("Qualcomm", 30, 50) GUISetState(@sw_show) while 1 Switch GUIGetMsg() $nMsg = GUIGetMsg() Case $GUI_EVENT_CLOSE GUISetState(@sw_hide) case $wifi1 If _IsChecked($wifi1) Then wifi11() EndIf case $wifi2 If _IsChecked($wifi2) Then wifi22() EndIf EndSwitch WEnd EndIf case $chb1 IF _IsChecked($chb1) Then If MsgBox(0, "Install", "To Install Nic Driver press OK") = 1 then lan() EndIf EndIf Case $BT1 ExitLoop EndSwitch WEnd Func wifi11() Run("O:\Drivers\HP\ProBook\450G1\WiFi - Intel\sp69971.exe") EndFunc Func wifi22() Run("O:\Drivers\HP\ProBook\450G1\WiFi - Qualcomm\sp64676.exe") EndFunc Func lan() Run("O:\Drivers\HP\ProBook\450G1\Lan\Install_Win7_7092_02252015\setup.exe") EndFunc Edited April 14, 2015 by MuffettsMan Don't let that status fool you, I am no advanced memeber! Link to comment Share on other sites More sharing options...
Solution MuffettsMan Posted April 14, 2015 Solution Share Posted April 14, 2015 ok that was a sad response... sry i'm rambling this works a bit better because i got past the while 1 i mentioned originally: (now you can jump into the second gui and back and still exit etc etc expandcollapse popup#RequireAdmin #include <WinAPIFiles.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc GUICreate("Driver loader", 500, 200) GUICtrlCreateTab(10, 10, 485, 185) Global $BT1 = GUICtrlCreateButton("Exit", 400, 150, 60) $G1 = GUICtrlCreateTabItem("HP 450G1") Global $chb1 = GUICtrlCreateRadio("LAN", 30, 30) Global $chb2 = GUICtrlCreateRadio("WiFi", 30, 50) Global $chb3 = GUICtrlCreateRadio("Chipset", 30, 70) Global $chb8 = GUICtrlCreateRadio("Media Card", 30, 90) Global $chb4 = GUICtrlCreateRadio("Video", 140, 35) Global $chb5 = GUICtrlCreateRadio("Rapid Storage Technology", 140, 55) Global $chb6 = GUICtrlCreateRadio("3D DriveGuard", 140, 75) Global $chb7 = GUICtrlCreateRadio("USB3", 140, 95) $G2 = GUICtrlCreateTabItem("HP 450G2") GUISetState(@sw_show) While 1 Switch GUIGetMsg() case $chb2 IF _IsChecked($chb2) Then subGUI() EndIf case $chb1 IF _IsChecked($chb1) Then If MsgBox(0, "Install", "To Install Nic Driver press OK") = 1 then lan() EndIf EndIf Case $BT1 Exit EndSwitch WEnd Func subGUI() GUICreate("WiFi", 200, 200) Global $wifi1 = GUICtrlCreateRadio("Intel", 30, 30) Global $wifi2 = GUICtrlCreateRadio("Qualcomm", 30, 50) GUISetState(@sw_show) while 1 Switch GUIGetMsg() $nMsg = GUIGetMsg() Case $GUI_EVENT_CLOSE GUISetState(@sw_hide) Return case $wifi1 If _IsChecked($wifi1) Then wifi11() EndIf case $wifi2 If _IsChecked($wifi2) Then wifi22() EndIf EndSwitch WEnd EndFunc Func wifi11() Run("O:\Drivers\HP\ProBook\450G1\WiFi - Intel\sp69971.exe") EndFunc Func wifi22() Run("O:\Drivers\HP\ProBook\450G1\WiFi - Qualcomm\sp64676.exe") EndFunc Func lan() Run("O:\Drivers\HP\ProBook\450G1\Lan\Install_Win7_7092_02252015\setup.exe") EndFunc dwaltosz 1 Don't let that status fool you, I am no advanced memeber! Link to comment Share on other sites More sharing options...
dwaltosz Posted April 14, 2015 Author Share Posted April 14, 2015 thanks that fixed the issue man i was getting so frustrated Link to comment Share on other sites More sharing options...
MuffettsMan Posted April 15, 2015 Share Posted April 15, 2015 np this me like every day Don't let that status fool you, I am no advanced memeber! 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