20Ice18 Posted August 22, 2022 Posted August 22, 2022 Sorry I'm new here. How can I prevent GUI freeze while the program is waiting for the answer from outside the program(specifically for answer from WindowsUpdateAgent). I've been struggling with it for a while... ❤️
20Ice18 Posted August 22, 2022 Author Posted August 22, 2022 29 minutes ago, 20Ice18 said: this is the code expandcollapse popupWhile True $nMsg = GUIGetMsg(1) #Region Buttons ;main GUI If $nMsg[1] = $Odin_GUI Then #Region Ready phase If $p_ready Then If $nMsg[0] = $chk_main[0] Then SelectAll() For $c = 1 To 3 If $nMsg[0] = $chk_main[$c] Then CheckBoxes() Next If $nMsg[0] = $btn_1win_set Then GUIWinSet() If $nMsg[0] = $btn_2update Then GUIUpdate() ; If $nMsg[0] = $btn_3programs Then GUIPrograms() If $nMsg[0] = $btn_start Then StartInstall() EndIf EndIf #EndRegion Ready phase If $nMsg[0] = $btn_log Then ShowHideLog() If $nMsg[0] = $GUI_EVENT_CLOSE Then CleanUp() Exit EndIf ;child GUI ElseIf $nMsg[1] = $GUI_child Then If $p_R_winset Then SelectWinSet($nMsg[0]) If $p_R_update Then SelectUpdates($nMsg[0]) ; If $p_R_programs Then SelectPrograms($nMsg[0]) ;Log GUI ElseIf $nMsg[1] = $GUI_log Then If $nMsg[0] = $GUI_EVENT_CLOSE Then ShowHideLog() EndIf #EndRegion Buttons #Region Actual installation If $p_I_winset Then Do_WinSet() If $p_I_update Then Do_Updates($nMsg[0]) ; If $p_I_programs Then Do_Programs() #EndRegion Actual installation If Not $p_ready Then UpdateInstallData() Sleep(10) WEnd ❤️
Subz Posted August 22, 2022 Posted August 22, 2022 Can you post the entire script? I'd probably suggest using Adlibregister to capture changes, I'd also use Switch/EndSwitch in place of the if statements for the gui see GuiCreate example in help file.
20Ice18 Posted August 22, 2022 Author Posted August 22, 2022 i think that function FindUpdates is freezing my gui but I'm not sure expandcollapse popupFunc Terminate() ConsoleWrite("Waiting" & @CRLF) $result = MsgBox(262148, "Exit?", "Are you sure you want to exit?") If $result = 6 Then Exit 0 EndIf EndFunc ;==>Terminate Func MainLoop() Local $nMsg HotKeySet("{F1}", "Hotkeys") HotKeySet("{F2}", "Hotkeys") HotKeySet("{F3}", "Hotkeys") HotKeySet("{F4}", "Hotkeys") HotKeySet("{F5}", "Hotkeys") HotKeySet("{ESC}", "Terminate") If _ArraySearch($prog_Overall, "Next") <> -1 And $prog_Overall[4][1] <> "" Then If $prog_Overall[1][1] = "Next" Then MsgBox(32, "?", "") StartInstall(1) Else GUICtrlSetState($btn_start, $GUI_DISABLE) LogThis("Odin awaits thy plan") EndIf While True $nMsg = GUIGetMsg(1) #Region Buttons ;main GUI If $nMsg[1] = $Odin_GUI Then #Region Ready phase If $p_ready Then If $nMsg[0] = $chk_main[0] Then SelectAll() For $c = 1 To 3 If $nMsg[0] = $chk_main[$c] Then CheckBoxes() Next If $nMsg[0] = $btn_1win_set Then GUIWinSet() If $nMsg[0] = $btn_2update Then GUIUpdate() ; If $nMsg[0] = $btn_3programs Then GUIPrograms() If $nMsg[0] = $btn_start Then StartInstall() EndIf EndIf #EndRegion Ready phase If $nMsg[0] = $btn_log Then ShowHideLog() If $nMsg[0] = $GUI_EVENT_CLOSE Then CleanUp() Exit EndIf ;child GUI ElseIf $nMsg[1] = $GUI_child Then If $p_R_winset Then SelectWinSet($nMsg[0]) If $p_R_update Then SelectUpdates($nMsg[0]) ; If $p_R_programs Then SelectPrograms($nMsg[0]) ;Log GUI ElseIf $nMsg[1] = $GUI_log Then If $nMsg[0] = $GUI_EVENT_CLOSE Then ShowHideLog() EndIf #EndRegion Buttons #Region Actual installation If $p_I_winset Then Do_WinSet() If $p_I_update Then Do_Updates($nMsg[0]) ; If $p_I_programs Then Do_Programs() #EndRegion Actual installation If Not $p_ready Then UpdateInstallData() Sleep(10) WEnd EndFunc ;==>MainLoop update.au3 ❤️
Zedna Posted August 22, 2022 Posted August 22, 2022 Generally you should add GUIGetMsg() (and eventually also test/reaction to its result) to all your extensive loops. Something like this: For ... If GUIGetMsg() = $GUI_EVENT_CLOSE Then $stopped = True ExitLoop EndIf Next Resources UDF ResourcesEx UDF AutoIt Forum Search
Subz Posted August 22, 2022 Posted August 22, 2022 Unfortunately cannot run the script as it's missing code, but having a loop within FindUpdates could be the cause of the issue, you may need to put error checks in place, to see where the error is occurring, but my guess would be the loop. If a function is going to take a long time to complete, I'd place a SplashTextOn at the beginning of the function and update the SplashText, showing progress throughout the function and then SplashOff once it's completed.
20Ice18 Posted August 22, 2022 Author Posted August 22, 2022 I would send the whole thing but it's really big(7 files,over 5000 lines)... But thank you for helping anyway guys. I will do my best to figure it out. ❤️ ❤️
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