CraigFu Posted February 14, 2012 Share Posted February 14, 2012 What's the best approach if I need a window to update with information while the main script runs normally? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 14, 2012 Moderators Share Posted February 14, 2012 Hi, CraigFu, welcome to the forum. Generally, the more information you can provide us with, the better. (A snippet of code is better yet). What kind of information are you updating the window with? Does it change the size and structure of the window? How about a screen shot of what the window would look like before and after? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
CraigFu Posted February 14, 2012 Author Share Posted February 14, 2012 Thanks for the reply. I have a set of 4 check boxes (Hot, Moderate, Cold, Very Cold). Each one has different parameters that will execute when the script is run. If 2 or more boxes were checked (i.e. Hot and Moderate), the script would run through Hot first, followed by Moderate. As the script executes I would like to show a status window that displays which step in the script is being executed for Hot and then it should say it's now on Moderate and here are the steps being executed. My issue is that when my status window pops up after the user selects the check boxes, it just stays there and the script doesn't execute. I hope I'm more clear. Thanks again. Link to comment Share on other sites More sharing options...
Guest Posted February 15, 2012 Share Posted February 15, 2012 You mean something like this. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Gui1() Func Gui1() Local $msg $Gui1 = GUICreate("My GUI",200,150) ; will create a dialog box that when displayed is centered $Hot = GUICtrlCreateCheckbox("Hot",30,20,200,17) $Moderate = GUICtrlCreateCheckbox("Moderate",30,40,200,17) $Cold = GUICtrlCreateCheckbox("Cold",30,60,200,17) $Very_Cold = GUICtrlCreateCheckbox("Very Cold",30,80,200,17) $StartBtn = GUICtrlCreateButton("Start",30,110,70,20) GUISetState(@SW_SHOW) ; will display a dialog box ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $StartBtn GUISetState(@SW_HIDE,$Gui1) Gui2() If GUICtrlRead($Hot) = $GUI_CHECKED Then GUICtrlSetData($Action,"Hot") If GUICtrlRead($SubAction) <> "" Then GUICtrlSetData($SubAction,"") EndIf Sleep(500) GUICtrlSetData($SubAction,"Step 1") Sleep(1000) GUICtrlSetData($SubAction,"Step 2") Sleep(1000) GUICtrlSetData($SubAction,"Step 3") Sleep(1000) EndIf If GUICtrlRead($Moderate) = $GUI_CHECKED Then GUICtrlSetData($Action,"Moderate") If GUICtrlRead($SubAction) <> "" Then GUICtrlSetData($SubAction,"") EndIf Sleep(500) GUICtrlSetData($SubAction,"Step 1") Sleep(1000) GUICtrlSetData($SubAction,"Step 2") Sleep(1000) GUICtrlSetData($SubAction,"Step 3") Sleep(1000) EndIf If GUICtrlRead($Cold) = $GUI_CHECKED Then GUICtrlSetData($Action,"Cold") If GUICtrlRead($SubAction) <> "" Then GUICtrlSetData($SubAction,"") EndIf Sleep(500) GUICtrlSetData($SubAction,"Step 1") Sleep(1000) GUICtrlSetData($SubAction,"Step 2") Sleep(1000) GUICtrlSetData($SubAction,"Step 3") Sleep(1000) EndIf If GUICtrlRead($Very_Cold) = $GUI_CHECKED Then GUICtrlSetData($Action,"Very Cold") If GUICtrlRead($SubAction) <> "" Then GUICtrlSetData($SubAction,"") EndIf Sleep(500) GUICtrlSetData($SubAction,"Step 1") Sleep(1000) GUICtrlSetData($SubAction,"Step 2") Sleep(1000) GUICtrlSetData($SubAction,"Step 3") Sleep(1000) EndIf Sleep(1000) GUICtrlSetData($Action,"Exiting") GUIDelete($Gui2) ExitLoop Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($Gui1) EndFunc Func Gui2() Global $Gui2,$Action,$SubAction $Gui2 = GUICreate("Status",300,80,-1,-1,$DS_MODALFRAME) ; will create a dialog box that when displayed is centered GUICtrlCreateLabel("Current Action:",10,10,70,17) $Action = GUICtrlCreateLabel("",82,10,100,17) GUICtrlCreateLabel("Sub Action:",10,30,55,17) $SubAction = GUICtrlCreateLabel("",67,30,200,17) GUISetState(@SW_SHOW) ; will display a dialog box EndFunc Link to comment Share on other sites More sharing options...
CraigFu Posted February 15, 2012 Author Share Posted February 15, 2012 Wow, I was thinking way to hard about this problem. I forgot about GUICtrlSetData(), great example! This should do the trick, much appreciated! 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