Sign in to follow this  
Followers 0
Draeko

Update a GUI from out of script

5 posts in this topic

I have a script that performs multiple installs of applications. It will be launching other scripts that I've written to install some of these applications.

In these separate scripts I have files being copied that display a progress bar inside a GUI. I'd like to know if it's possible to have these other scripts updating a progress bar on a GUI created by the primary script.

Share this post


Link to post
Share on other sites



Make child GUI's instead of other scripts?

Share this post


Link to post
Share on other sites

No, the scripts need to be completely separate, as they will sometimes be run without the primary script launching them.

Make child GUI's instead of other scripts?

Share this post


Link to post
Share on other sites

I have a script that performs multiple installs of applications. It will be launching other scripts that I've written to install some of these applications.

In these separate scripts I have files being copied that display a progress bar inside a GUI. I'd like to know if it's possible to have these other scripts updating a progress bar on a GUI created by the primary script.

You need some way to send information from one script to another. I don't know how you can set the position of a progress bar, but you could send information the the main script so that the main script could decide how to set the progress bar.

A simple way is to have an edit in the main gui, which need not be visible except for testing. You can set it to be hidden using

GuiCtrlSetState($Edit1,$GUI_HIDE);$GUI_SHOW to show

One script can send a string to the edit in the main gui like this

ControlSend("Main Title","","Edit1","state of child 5 is " & $myProgress & @CR)

Another way is to send a message to the main window. ChrisL has an interprocess communications udf in Example scripts which makes that quite easy.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

This actually helped set me on the right track. I used the following code example to get this working.

Thanks for the help! :P

Script 1 (GUI)

#include <guiconstants.au3>
Dim $PROG1, $INPUT1

$GUI1 = GuiCreate("testGUI", 300, 40)
$PROG1 = GUICtrlCreateProgress(10, 10, 280, 20)
$INPUT1 = GUICtrlCreateInput("", 10, 40, 50, 20)
GUICtrlSetState($INPUT1, $GUI_HIDE)
GuiSetState()
Do
    $msg = GUIGetMsg()
    GUICtrlSetData($PROG1, GUICtrlRead($INPUT1))
Until $msg = $GUI_EVENT_CLOSE

Script 2 (Updater)

For $i = 0 to 100
    ControlSetText("testGUI", "", "Edit1", $i)
    Sleep(1)
Next
ControlSetText("testGUI", "", "Edit1", 0)

You need some way to send information from one script to another. I don't know how you can set the position of a progress bar, but you could send information the the main script so that the main script could decide how to set the progress bar.

A simple way is to have an edit in the main gui, which need not be visible except for testing. You can set it to be hidden using

GuiCtrlSetState($Edit1,$GUI_HIDE);$GUI_SHOW to show

One script can send a string to the edit in the main gui like this

ControlSend("Main Title","","Edit1","state of child 5 is " & $myProgress & @CR)

Another way is to send a message to the main window. ChrisL has an interprocess communications udf in Example scripts which makes that quite easy.

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