Jump to content

Update GUI window while script executes


Recommended Posts

  • Moderators

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 post
Share on other sites

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 post
Share on other sites

You mean something like this.

#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 post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...