Hi guys
i was wondering if it was possible to create a script that looks if a specific piece of the screen keeps staying the same and if it does then react to it.
it has to look for an image of an error and if that error stays there for more than 10 sec then it has to react but do nothing if its there for less than 10 sec.
it is because i get an error that shows in a program but it is usually removed by the program itself but in rare cases the program does not remove it and then the script should do it. the error does not show as a window but only in writing
Bruno
how to keep looking for a pic
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Use FindImagePos in a loop.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
So measure elapsed time. Use FindImagePos in a loop. If the image is found keep looping until 10 seconds is up. Keep checking that it's there in each iteration. Stop when 10 seconds is up or the image is no longer found. If at the end of the loop the image is still there, pop up your message.
Use:
FindImagePos
Label
Goto
VBEval>Timer,....
Use:
FindImagePos
Label
Goto
VBEval>Timer,....
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Ok here is a script that loops and keeps looking for the error.bmp im having a hard time understanding how to implement the timer function, when it will start counting and what it will do when the time is up
label>str
FindImagePos>c:\error.bmp,SCREEN,0,1,X,Y,NumFound
If>NumFound>0
//here i guess i need to implement the vbeval feature but how ?
// eg. ebeval>timer,10
goto>str
Else
goto> str
Endif
//here ill put the removal of the error features
label>str
FindImagePos>c:\error.bmp,SCREEN,0,1,X,Y,NumFound
If>NumFound>0
//here i guess i need to implement the vbeval feature but how ?
// eg. ebeval>timer,10
goto>str
Else
goto> str
Endif
//here ill put the removal of the error features
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Try searching the forum for VBEval>Timer or Elapsed time.
Here's an UNTESTED bit pseudo code. Fill in the blanks:
Here's an UNTESTED bit pseudo code. Fill in the blanks:
Code: Select all
VBSTART
VBEND
VBEval>Timer,starttime
Label>wait_image
FindImagePos>....NumFound
If>NumFound>0
VBEval>Timer-%starttime%,ElapsedTime
If>ElapsedTime<10
Goto>wait_image
Endif
Endif
//if we get here either the image no longer exists or wasn't there
//in the first place, or we've waited more than 10 seconds, which is it?
If>NumFound>0
MessageModal>Message is still there after 10 seconds
Endif
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Hi
i spend some time trying out your suggestion. i replaced the info in the findimagepos> line in your suggestion with my own info but i kept getting an error it is translated since i have a windows version in my native tongue
"
a microsoft VBScript-compiling error :1002 occurred
Its a syntax error
line 2, column 10
"
i guess its the "-" after timer that needs to be changed to a ","?? i tried changing it and now the error stopped.
but im still not sure how to solve my problem.
when using debug and trace i can see that the script stalls at the last if>numfound>0 and stays there. never displaying the message or getting to "endif[/code]"
where in the script can i put the commands it should do if the image stays for more than 10 sec.
and where to put the commands the scipt should do if the image changes within the 10 secs?
Sorry for all the newbie questions
B.
i spend some time trying out your suggestion. i replaced the info in the findimagepos> line in your suggestion with my own info but i kept getting an error it is translated since i have a windows version in my native tongue
"
a microsoft VBScript-compiling error :1002 occurred
Its a syntax error
line 2, column 10
"
i guess its the "-" after timer that needs to be changed to a ","?? i tried changing it and now the error stopped.
but im still not sure how to solve my problem.
when using debug and trace i can see that the script stalls at the last if>numfound>0 and stays there. never displaying the message or getting to "endif[/code]"
where in the script can i put the commands it should do if the image stays for more than 10 sec.
and where to put the commands the scipt should do if the image changes within the 10 secs?
Sorry for all the newbie questions
B.