Hotkey not working

Asked by colonel_claypoo

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:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
masuo
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
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

Revision history for this message
colonel_claypoo (colonelclaypoo) said :
#2

Thanks masuo, that solved my question.

Revision history for this message
colonel_claypoo (colonelclaypoo) said :
#3

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

Revision history for this message
Best masuo (masuo-ohara) said :
#4

There is a way to sleep instead of popup.

sleep(60)

Revision history for this message
colonel_claypoo (colonelclaypoo) said :
#5

Thanks masuo, that solved my question.