Set global hotkey without a KeyModifier --- modifier parameter (2nd) must be 0

Asked by L E

Hi,

Is it possible to set a global hotkey without a KeyModifier - for example, if you just press F1 without a KeyModifier it executes the handler.

Thanks,

L E

Question information

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

Windows?

did you try it already?

Generally spoken: should be possible.

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

I eventually tested and it works:

Env.addHotkey("x", 0, handler)

Revision history for this message
Alex Lunyov (lunyov-av) said :
#3

So, there is no way to pass a KeyModifier argument in addHotkey function, right? We have to give 0 value in the modifier position to set handler of a pure key press.

Just remembered your advice in the recent "Key.NONE" history (in my question #295399) and then try to search through other questions about this exact problem.

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

Yes, it must be used as mentioned in comment #2

Revision history for this message
Alex Lunyov (lunyov-av) said :
#5

OK, thanks!

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

yes