how to use loop for taking screen shots till a image appears

Asked by arush

I have a case in which I want to take continuous screen shots at a regular interval of 30 sec till a particular image appears. how to do it . .I am using sikuli with java

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jeremy (hsloan1a) said :
#1

If I'm reading it right, this is what I do:

int error_count = 0;
while(s.exists(screenImage,0) == null){
Thread.sleep(500);
error_count++;
//sometimeout number
if (error_count > 10)
return false; //program was stuck and didn't work. Try again.
}

I usually have other fanciness that happens so I put in a timeout or looking for other options.

Can you help with this problem?

Provide an answer of your own, or ask arush for more information if necessary.

To post a message you must log in.