Jump to content

Please wait function with continued processing


Thingy2nl
 Share

Recommended Posts

Hi,

Not sure if anybody is interested, but I came across some questions about a wait screen to present to the user while the system is doing whatever needs to be done. I could not find something the was easy to use and stayed on screen while the script actually continues. So I came up with the follow.... maybe somebody will find it usefull.

I started by getting a semi random wait animated gif. I use this one:

Posted Image

Then I proceded to add the _GUIResourcePic.au3 from JScript found here:

Finally i added 2 functions to my au3 like this:

Func Wait( $WaitTime )
$smallform = GUICreate('', 214, 138, Default, Default, BitOR($WS_POPUP, $WS_BORDER), $WS_EX_TOPMOST)
_GUICtrlPic_Create(".\processing.gif", 1, 1, 0, 0)
GUISetState(@SW_SHOW, $smallform)
sleep( $WaitTime)
EndFunc

Note the @smallform that I declare Global in a seperate au3 and the size settings 214, 138 that are the same size as the gif.

Func EndWait()
GUIDelete($smallform)
EndFunc

Now, when i know I am going to do something that will take some time, I call the Wait() function. That will open a new, borderless GUI

telling the user to wait, and when done, turn off the GUI with the EndWait().

I added the variable sleep time because I have somoe functions that will take 4 or 5 seconds. To short to build the GUI and display it

correctly, but to long not to show anything. In those cases I add additional 2 or 3 seconds waittime to give the GUI time to build and the

user to actually see something.

Secondly, I choose to rebuild and delete the GUI every time a I had some issues reusing just one GUI. The GUI would display, but the

animated GIF was not shown on consecutive uses....

So, hope someone can use this to his advantage

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...