← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #703916]: How to loop entire Script

 

Question #703916 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/703916

    Status: Open => Answered

Manfred Hampl proposed the following answer:
What you need can be found by a web search for "python while".

running = True

def runHotkey(event):
    global running
    running = False

Env.addHotkey(Key.ESC, KeyModifier.SHIFT+KeyModifier.CTRL, runHotkey)

while running:
    click(Location(41,1300))
    click(Location(38,1179))
    wait(1)
    click(Location(367,965))
    click(Location(420,991))
    ...
    (all commands to be repeated need to be indented by the same amount of whitespace)

Remark: You have to make sure, that the hotkey that you select does not
conflict with hotkeys in other programs, especially in the operating
system. As far as I know, on a Windows system ctrl-shift-esc starts the
task manager and this has precedence, so that key combination does not
work in Sikulix on Windows.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.