← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #173798]: need help with loop

 

Question #173798 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/173798

    Status: Open => Answered

RaiMan proposed the following answer:
the magic is indentation. (read more on loops: faq 1437)

- use tab to indent one level (here shown as <tab>)
- use shift-tab to decent one level  (here shown as <shift-tab>)

(in the standard setting, IDE will replace each tab with 4 spaces and a
shift-tab will delete 4 spaces at beginning of statements)

Tip: always use tab/shift-tab! never mix it with spaces entered by
yourself.

The current version of Sikuli (rc3) supports an automatic:
the line after a line ending with a colon (e.g. for n in range(4000):) will indent the next line automatically one level

To end the indentation: use shift-tab on the line, that has to be
dedented.

Your script (if I understand right):

type(text)
type(text)
# used for login
for n in range(4000):
<tab>click()
<tab>click()

click(logout pic )
type(text)
type(text)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.