Wait for a window to fully load.

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Tourless
Pro Scripter
Posts: 69
Joined: Wed Jun 14, 2017 1:53 am
Location: NY

Wait for a window to fully load.

Post by Tourless » Wed Jun 28, 2017 12:25 pm

Hi Folks,

So I'm moving along on my first 'real' project and have run into a problem where I need to wait for a window/program to finish opening before moving on to my next step. I'm sure I could build in a long enough wait time but I'd like to know if there is a way to have the macro monitor or check that there is no more activity in the window/program and then move on.

Perhaps is there a way to check for the existence of ui element within the window/program? Can I identify the process and monitor it's cpu usage? The last thing to load is a left-hand side-bar with menus and shortcuts if that's of any use or help.

thanks in advance all.

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Wait for a window to fully load.

Post by JRL » Wed Jun 28, 2017 1:24 pm

There are many possibilities.

Have you tried the WaitReady> function?

You could use image recognition and wait for a small section of the window to look a specific way.

If you're waiting for the window to be ready to accept a specific action (mouse click, button press, etc) you could perform that action in a loop the loop would also test for the reaction (window opens, process starts, etc). Break out of the loop when the reaction test is positive.

Are the objects in the window identifiable? If yes perhaps you can wait for the left hand sidebar to open using the FindObject> function.

Tourless
Pro Scripter
Posts: 69
Joined: Wed Jun 14, 2017 1:53 am
Location: NY

Re: Wait for a window to fully load.

Post by Tourless » Wed Jun 28, 2017 8:44 pm

I was unaware of WaitReady and that seems to be working. Thanks J!

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