More begginer helP - take action if screen does not change

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
jamestdsmith
Newbie
Posts: 3
Joined: Fri Jan 14, 2011 7:32 pm

More begginer helP - take action if screen does not change

Post by jamestdsmith » Sat Jan 15, 2011 9:01 am

Hi

i have a nice long macro which sometimes works fantastic, and other times, just pauses and does nothing - I assume the image capture isnt working or the Wait's aren't long enough.

does anyone know of a way that I can do the following:

If the screen stays exactly the same for more than 5 minutes, then goto one of my labels?

This would make a really useful backstop for my macro

any help is really apprecaited.

thanks

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Mon Jan 17, 2011 6:51 pm

One way to make your macros more reliable so this doesn't happen is to set

Let>WW_TIMEOUT=15

and then after every "window open/close" type command check the status like so:

WaitWindowOpen>mywin
If>WW_RESULT=FALSE,Bad

Label>Bad

What this does, is make the WaitWindowOpen only wait for ww_timeout seconds, and then the next If command will send the script to label>Bad
if the window doesn't open in the time allotted.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Mon Jan 17, 2011 7:30 pm

This doesn't do exactly what you are looking for, but play with it, you may find it useful.

(Note 300 seconds = 5 min)

You might want to set this to a small value while testing.... I used 5

Start it running and then if more than x min elapsed
before the foreground window changes, it triggers
the message.

Code: Select all

VBSTART
VBEND

VBEval>Timer,StartTime
OnEvent>WINDOW_NEWACTIVE,0,0,DoNewWindow


Let>k=1
Repeat>k
  Wait>0.01
  Add>k,1
Until>k>10000


SRT>DoNewWindow
  VBEval>Timer,EndTime
  Let>ElapsTime={%EndTime% - %StartTime%}
  If>{%ElapsTime% > 300}
     MessageModal>%ElapsTime% seconds elapsed
     VBEval>Timer,StartTime
  Else
     VBEval>Timer,StartTime
Endif
  
END>DoNewWindow



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