Wait for x amount of time defined by input box

Asked by Brendan Sapp

I am trying to get a input command to determine the amount of time a wait lasts for. How can I use input to determine the wait time?

time_city = input("How long would you like City to run for?")
wait(time_city)

When I run that I am given this error

*I inputted 9 as the time to wait

[error] ImagePath: find: not there: 9.png
[error] script [ sikulitemp-11817012733325062134 ] stopped with error in line 2
[error] FindFailed ( 9 as text )
[error] --- Traceback --- error source first
line: module ( function ) statement
63: Sikuli ( wait ) return SCREEN.wait(target)
2: main ( <module> ) wait(time_city)
[error] --- Traceback --- end --------------

Question information

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

see https://answers.launchpad.net/sikuli/+question/235023

and:

For wait(value) to wait for the given period, value has to be a number.
time_city = input("How long would you like City to run for?"), however, returns a string value.

What you need might be

wait(int(time_city))
or
wait(float(time_city))

Revision history for this message
Brendan Sapp (hypelights) said :
#2

Thanks Manfred Hampl, that solved my question.