Sign in to follow this  
Followers 0
Sabre31

NewBie GUI RunWait Help!

3 posts in this topic

Hi -

I am trying to add a Gui Form that when it launches it will execute external apps or commands using runwait. When the form loads it will execute the runwait app or external command and then update the progress bar while it runs through each app or command as it completes. Can you please tell me how I can do that using the form below?

I would like to do the following:

1. Load the GUI form and start executing commands or external apps using RunWait

2. Once each RunWait command completes move the progressbar

3. Update the Label Text Fields of what command or app is being executed

4. When a user hits the cancel button the form will quit

Any help is really appreciated thanks so much for the help

#include <GUIConstants.au3>

$Form1 = GUICreate("MYFORM", 633, 418, 193, 115)
$Label1 = GUICtrlCreateLabel("STATUS", 48, 56, 43, 17)
$Label2 = GUICtrlCreateLabel("PROGRESS", 48, 88, 43, 17)
$Button1 = GUICtrlCreateButton("CANCEL", 256, 360, 75, 25, 0)
$Progress1 = GUICtrlCreateProgress(96, 304, 430, 17)
GUICtrlSetData(-1, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Share this post


Link to post
Share on other sites



First: do you REALLY want to start executing everything once the GUI is loaded? It wouldn't be better to add a button to start?

#include <GUIConstants.au3>

$Form1 = GUICreate("MYFORM", 633, 418, 193, 115)
$Label1 = GUICtrlCreateLabel("STATUS", 48, 56, 43, 17)
$Label2 = GUICtrlCreateLabel("PROGRESS", 48, 88, 43, 17)
$Button1 = GUICtrlCreateButton("CANCEL", 256, 360, 75, 25, 0)
$Progress1 = GUICtrlCreateProgress(96, 304, 430, 17)
GUICtrlSetData(-1, 25)
$start = GUICtrlCreateButton (... whatever you want here)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $start
            start()
        Case $Button1
            pclose()
    EndSwitch
WEnd

Func start()
   GUICtrlSetData (your label here will be updated with the program name you're going to run)
   RunWait (whatever ...)
   GUICtrlSetData (progress bar percentage filled)
   GUICtrlSetData (your label here will be updated with the second program name you're going to run)
   RunWait (whatever 2...)
   GUICtrlSetData (progress bar percentage filled again)
   ... and so on
EndFunc

Func pclose()
   Exit
EndFunc

Look at: GUICtrlSetData and RunWait and you will be able to make your script to do whatever you want.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Thank you so much I appreciate the quick reply and help.

Share this post


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
Sign in to follow this  
Followers 0