← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #182257]: fail to stop a running *.skl

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
-- 1. running *.skl
I do not understand, why you are talking about a .skl: when running something in the IDE (you want to inspect the message area) one usually have .sikuli. 
It is always possible to run the script from command line and see the out put in the command window just as it is produced.

--- 2. your setting of the hot key does not work
If this is all the code in your script, then the hotkey will never be implemented, if stopScript() is not called.
But even if it is called, it will abort with "quit(Clicker.sikuli)", because Sikuli does not know, what quit is.

-- 3. setting a hot key
I understand, that you want to run a script and interrupt it with a self defined hot key (Sikuli already has one to abort a script: Windows: shift-alt-c, Mac: shift-cmd-c), to get back to the IDE window and inspect the message area.

This is how it should be:

**** some-script.sikuli
def stopHandler(event):
    # here we define, what should be done
    # in case the key is pressed
    exit() # we want to exit the running script

Env.addHotkey(Key.F1,KeyModifier.ALT+KeyModifier.CTRL, stopHandler)

n = 0
while n < 1000:
    click("START.png")
    wait(1)
    click("START.png")
    n = n + 1
    wait(1)

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