While statement do not work

Asked by srijith on 2010-02-03

while statement do not work for me in Sikuli for Leopard.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
srijith
Solved:
2010-02-04
Last query:
2010-02-04
Last reply:
2010-02-03
RaiMan (raimund-hocke) said : #1

Hi from Snow Leo ;-)

what did you do? Copy/paste your Sikuli here!

srijith (electronicmails1) said : #2

while not find( ):
click( )
click( )
click( )
sleep(20)
click( )
...
...
...
...

srijith (electronicmails1) said : #3

hey! i am using leopard not snow leopard

srijith (electronicmails1) said : #4

I get the error
SyntaxError: ('invalid syntax', ('/var/folders/qU/qUDzFEqDFOeW3Hv3egMOhk+++TI/-Tmp-/sikuli-tmp1331967974505371101.py', 24, 1, 'click("1265191135132.png")'))

when trying to run

RaiMan (raimund-hocke) said : #5

Hi, its me who uses snow leo - I said Hi FROM snow leo ;-)

in python (Sikuli syntax is based on python) blocks are identified by indenting.

So it should read:

while not find( ):
    click( )
    click( )
# these 2 clicks are inside the while-loop

click( ) # this click is the next statement after completion (pattern found) of the while loop.

some examples: (pass is python and means: do nothing)

while condition:
    pass
pass # after the while loop
if condition:
    pass # if true
else
    pass # if false
    while condition:
         pass #inside while
    pass # inside else, after while
pass # after if-else

hope its clear - or have a look at http://docs.python.org/

srijith (electronicmails1) said : #6

Ya! I just missed the indents
thnks