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
More begginer helP - take action if screen does not change
Moderators: JRL, Dorian (MJT support)
-
- Newbie
- Posts: 3
- Joined: Fri Jan 14, 2011 7:32 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.
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.
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.
(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