WaitReady Issues / Busy Cursor Resetting

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
mheptinstall
Newbie
Posts: 3
Joined: Mon Nov 25, 2013 10:28 am

WaitReady Issues / Busy Cursor Resetting

Post by mheptinstall » Mon Nov 25, 2013 10:38 am

Hello

I'm having some issues with a script where I am trying to use WaitReady. The script uses keyboard commands to tab to a checkbox and then press space to turn the checkbox on which updates a combobox. Sometimes this combobox update can be done in a few seconds and other occasions it takes much longer.

I have tried to use WaitReady>1 so that the script waits for the combobox to update though this doesn't appear to work all the time. When looking at the cursor on occasions where the combobox refresh takes longer than usual, the busy icon (Windows 7 circle) flickers like it is being reset throughout the process. The WaitReady does intially wait but then the remainder of the script executes when in fact the window is not actually fully ready.

I think I need to create my own WaitReady procedure in this instance but I am not sure how I would go about doing this? My idea would be to check the current cursor state within a loop which contains a Wait>1 and compares with the previous cursor state to see if the window is truely ready.

Any suggestions on how I could implement something like this?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Nov 25, 2013 3:48 pm

WaitReady>1 waits for the foreground application's WM_PAINT events to stop firing. That probably won't help for drop down boxes in all cases, and won't always help for all apps - it's designed for when you have just started an app/opened a window are waiting for the app's rendering to settle down. Sometimes it will wait forever as some apps won't stop painting. So it really is a case of suck it and see.

If there is something visual that tells you the box is ready I would use WaitScreenImage and wait for that visual element. You say there is a "busy icon". Perhaps you can use the image recognition wizard to look for that and wait until it is visible.

You can wait for he cursor to change with WaitCursorChanged. That may only work for system cursors and may not be able to detect application level cursors. So again - suck it and see - but you'd probably need two - one to detect the change to busy and the other to detect the change back.

My recommendation would be to use image recognition and WaitScreenImage as that is the most analogous to how us humans know when something is ready - we watch the screen for visual cues.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts