Sign in to follow this  
Followers 0
Thingy2nl

Please wait function with continued processing

2 posts in this topic

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

Share this post


Link to post
Share on other sites



Hello, and thank you !

I tested your script, and I've no problem with consecutive uses.

I just changed

sleep( $WaitTime )
to
sleep( $WaitTime * 1000)

So I can use your function with

Wait(10) ;time in seconds

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