How to stop running script when ALT+SHIFT+C is not possible? --- workaround

Asked by Yadong Yu

---- workaround ---------------- (thanks to post #2)
# add to main script
def StopScript(event):
    sys.exit()
Env.addHotkey(<<key>>,<<modifier>>, StopScript)
# use a suitable key/modifier combination
------------------------

I'm running my script from command line, and i know that hotkey "ALT+SHIFT+C" can do that.
However, hotkey conflict makes this not work sometimes....
Is there any other reliable way to stop the current running script?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said (last edit ):
#1

Sorry, currently not.

You have to abort the running task with system means.

I will make the stop-hotkey configurable (see: https://github.com/RaiMan/SikuliX1/issues/569 )

Revision history for this message
Corentin Gauquier (cocowork) said (last edit ):
#2

I think i alredy read a workaround for this :

Just from my memory, I'd say it is something like that :

import sys
def StopScript(event):
    sys.exit()

Env.addHotkey(Key, KEY_CTRL, StopScript)

I think it is somewhere on this launchpad, I'll edit this post if I can find it again.

EDIT : Well it was quick, here's the link to the question, the answer is this one : masuo (masuo-ohara) said on 2015-08-14
https://answers.launchpad.net/sikuli/+question/270342

Revision history for this message
RaiMan (raimund-hocke) said :
#3

@Corentin
Thanks for the hint.
At least a workaround, but you need it in every main script you are using.

So some global configurable option might be useful. I have it on the list now.

Can you help with this problem?

Provide an answer of your own, or ask Yadong Yu for more information if necessary.

To post a message you must log in.