how to give default timeout in sikuli

Asked by chaitu

I have a popup with 10 options..If i didn't select any option by default it should run some other sikuli script after some time.

How to give time dealy so that it will wait for that time to complete and will execute the other sikuli script..

can anyone please help me out .??

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Roman Podolyan (podolyan-roman) said :
#1

Sorry, it is not exactly clear what you are trying to do and what you want from Sikuli.

It is very simple to make Sikuli wait for some time with wait() function:

http://doc.sikuli.org/region.html
wait([PS][, seconds])

If those popup has one and the same image when nothing selected, you can wait and then look if the "default look" image is present with exists() function and run code depending on result.

Revision history for this message
chaitu (chaitu123) said :
#2

when i run my sikuli script using jython interpreter in eclipse it is showing one popup with 5 names.I wrote code like that.
If i select first name and press ok then automatically it will go and run that particular module.

i am able to run that thing..But what my problem is what if i didn't select any name in popup.
if i didn't select any name in popup,,after 10 sec by default it should go and run the method which is under default section.

so here i have to give time delay 10 sec so that if no option is selected then after 10 sec it will go and run the default method.
how should i do this..please help me out.

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

what feature did you use to display the select popup?
paste a relevant code snippet.

Revision history for this message
chaitu (chaitu123) said :
#4

choice=Select("pick any name",options=myOptions)

Revision history for this message
chaitu (chaitu123) said :
#5

hi RaiMan,

here we are selecting one option in popup but if we didnt select any option after 10 secs by default it should run the default method

help me in this ..how to give that time delay ??

Revision history for this message
chaitu (chaitu123) said :
#6

myOptions=('none','1.first','2.second','3.Third','4.four','5.five')

choice=select("pick a name",options=myOptions)

when i run this it will display a popup with 5 options in eclipse using python and jython.

if choice=='1.first':
    s=Screen()
    s.click("first.png")
    s.wait("second.png")

if choice=='2.second'
     s=Screen()
    s.click("ok.png")
   s.wait("yes.png")

like this i wrote it for remaining 3 options also..

when i run this sikuli script in eclipse..It shows the popup with 5 options and when i click First on the popup ,,it will go to that first module and click and wait functions will be executed.like this the flow continues.

if i didn't select any option in popup for 20 sec..by default it should go and run the default section..

how can i give time dealy ?

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

ok, understood.

A timeout for SikuliX popups is currently not a feature, sorry.

The only workaround: put it in a thread
Use the appropriate Python feature to start a thread in parallel, that displays the select popup.
In main wait for the thread to finish and get the result. If thread does not finish within 20 seconds, kill it and continue with your default.

right now I do not have the time to write code for that. So come back later, if you get lost with this.

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

made it a request bug