How to wait for a duplicated Image (Img already in screen, wait for a duplicated Img)

Asked by eduardobedoya

How can I wait for an Image (eg. RedStartImg) but sometimes there is already a RedStartImg in the screen and it will appear a second one, How can I wait for that second RedStartImg? sometimes there are two RedStartImg and it will appear a third one, some times there is None and it will appear one, How can I wait for that RedStartImage in this case? I know that RedStartImage takes to appear from 0.5 to 2 secs.

please somebody, any hint?

Thanks Advanced.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Manfred Hampl (m-hampl) said :
#1

Are you able to predict in which part of the screen the new image will appear or is this unpredictable?

Revision history for this message
eduardobedoya (gonnabdh) said :
#4

the y axis is predictable
the x axis is unpredictable
in fact, the region in which Im searching is an horizontal rectangle (all the screen width and 300px height)

Do I first got to find all previous Matches of the Img, count them before
[run another predifined function] and then count them again, and see if another same Img appear right?
but my problem is when there is no image at the beginning (first count), cuz if so, Sikuli AutoWaitTime takes hole three seconds to set the first count = 0. How can I get the findAll result faster (in 1 sec) if there is not image at the beginning?
I guess I would have to set the autowaittime to 1sec before run the first count, and then restore it to 3secs, cuz in all others findImg actions in my script I would like to wait 3 secs.
Isn't any other way to kinda set autowaittime for a single findAll, (like in the 'wait' action or in the 'exists' actions which have their own autowaittime that can be set individually in each action), or any other action that could replace the findAll, that could have its own autowaitime that could be set individually in each action?

Is there is another better approach to do this task, please give me a hint of how the python code would look like?

THanks Advanced.

Revision history for this message
Best RaiMan (raimund-hocke) said :
#5

first use exists(image, 0), to check for the existence (with a restricted search area this costs some 10 millisecs).

If found then do your findAll().

So there is no need to fiddle around with waittime with findAll (see your other question)

Revision history for this message
eduardobedoya (gonnabdh) said :
#6

Thanks RaiMan, that solved my question.