Hotkey not working

Asked by colonel_claypoo on 2017-07-20

Hello,

I`m new to SikuliX. I wanted to call a function with a hotkey. However, I can`t get it to work.

This is the complete code in my script, bare minimum:

def startButton(event):
    click("1500539809932.png")

Env.addHotkey(Key.F1, KeyModifier.CTRL + KeyModifier.SHIFT, StartButton)

Now when I click the 'run' button in the IDE noting happens except for the fact that the IDE gets minimized and restored within a split second. The output log in the IDE reads:

[info] HotkeyManager: add Hotkey: STRG+UMSCHALT F1 (112, 3)

Calling the script from the command line produces the same results.

I`m on Windows 10 x64 using SikuliXIDE 1.1.1

Thanks in advance for your help.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
masuo
Solved:
2017-07-20
Last query:
2017-07-20
Last reply:
2017-07-20

This question was reopened

masuo (masuo-ohara) said : #1

Any code not to exit program is necessary.

def startButton(event):
    click("1500539809932.png")

Env.addHotkey(Key.F1, KeyModifier.CTRL + KeyModifier.SHIFT, startButton) #<--- change "S" to "s"

popup("Click [OK] to exit") #<--- add this code

Thanks masuo, that solved my question.

Is there a way not to require a popup? It`s a little annoying after a couple of executions. But thanks so far!

Best masuo (masuo-ohara) said : #4

There is a way to sleep instead of popup.

sleep(60)

Thanks masuo, that solved my question.