Does onAppear() has a minimun default time?

Asked by CCIOLA

I'm trying to write an instruction to wait for an image appear on the screen, but sometimes my aplication takes too long to show the image, sometimes shows it on a shor period of time.

I'm using

      onAppear(myImage.png, myFunction())

but when my image takes a long time to to be shown, it seems like onAppear has a default waiting time to work, so it breaks the execution before the image be found on the screen.

I've tried to use while, but it doesn't work like I explained above:

     while not find(myImage.png)
     sleep(FOREVER)

Do you know how can I do to wait for 20 seconds for the image, for example, and break the waiting as soon the image appears?

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
Best RaiMan (raimund-hocke) said :
#1

this is correct:

 onAppear(myImage.png, myFunction)

ONLY the name of the function!!! (see docs)

in your case the function is run at the moment the interpreter processes onAppear.

When you use the observe feature, I recommend to upgrade to version 1.1.1 and carefully read the doc chapter.

Revision history for this message
CCIOLA (carol-ciola) said :
#2

Thanks RaiMan, that solved my question.