[request] trigger script runs with hotkeys --- not a feature yet

Asked by waterking

the request is tracked on GitHub:
https://github.com/RaiMan/SikuliX1/issues/579
------------------------------------------------------------

Can you consider adding a hotkey to run it?
For example, if I created 3 scripts, I would like to set them to F1, F2, and F3 respectively.

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
Joe L. Thompson (joelthompsons) said :
#1

Certainly, I can help you with that. Adding hotkeys to run your scripts is often a convenient way to quickly access and run them.

To set a hotkey for a specific script, you can follow these steps:

Open your software and navigate to the settings or preferences menu.
Look for a section related to keyboard shortcuts or hotkeys.
Find the option to "Add new shortcut" or "Create custom shortcut."
Select the command or action you want to assign a hotkey to (in this case, running a specific script).
Press the key combination you want to use as the hotkey (e.g., F1, F2, F3).
Save your changes and exit the settings menu.
You should now be able to use your assigned hotkeys to execute your scripts quickly and easily. If you have any difficulties or require further assistance, please let me know.

Revision history for this message
waterking (watergun) said :
#2

Thank you very much for your reply:

But,I didn’t find the "Add new shortcut" or "Create custom shortcut"options in the software’s settings or preferences menu. I’m using ‘sikulixide-2.0.5-win.jar

If possible, I would like to take a screenshot and show it to you

Revision history for this message
waterking (watergun) said :
#3

[image: 49730beed185b8e5242d855337d067d.png][image:
3bfe39a5389abfb374f78294095d97f.png][image:
b54fe4a3ef09441fdd3af949bfcca1a.png][image:
eec545c5085f3283c83088d73232988.png][image:
735ea4500ee66674c03be36d0d7adc2.png]

Sorry, as shown in my screenshot, there is no option button you mentioned.
Did I download the wrong software?

waterking <email address hidden> 于2023年4月20日周四 12:55写道:

> Your question #706301 on SikuliX changed:
> https://answers.launchpad.net/sikuli/+question/706301
>
> Status: Answered => Open
>
> You are still having a problem:
> Thank you very much for your reply:
>
> But,I didn’t find the "Add new shortcut" or "Create custom
> shortcut"options in the software’s settings or preferences menu. I’m using
> ‘sikulixide-2.0.5-win.jar
>
> If possible, I would like to take a screenshot and show it to you
>
> --
> You received this question notification because you asked the question.
>

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

@Joe L.Thompson:
SikuliX currently does not have such a general Hotkey setup feature in the Preferences.

Surely it might be possible to arrange a systemwide hotkey, that runs a SikuliX script from command line, but this has the disadvantage, that with every activation, you have the startup delay of some seconds and you have to assure, that only one script runs and terminates, before another script can start.

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

@waterking
As mentioned: there is currently no feature, that allows to run a script triggered by a hotkey.

But generally it is possible to run script code, that is implemented in functions (def runAtHotkey(): ...) as a reaction to a hotkey press.

See here for the general usage layout:
https://sikulix-2014.readthedocs.io/en/latest/interaction.html#listening-to-global-hotkeys

Bea aware: It needs some deeper understanding of Python scripting with stuff, that is implemented elsewhere (e.g. other scripts) and needs to be imported for use and run.

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

tracked on Github

Revision history for this message
waterking (watergun) said :
#7

Thank you very much for your patient answer

RaiMan <email address hidden> 于2023年4月21日周五 22:55写道:

> Your question #706301 on SikuliX changed:
> https://answers.launchpad.net/sikuli/+question/706301
>
> Status: Answered => Solved
>
> RaiMan changed the question status:
> tracked on Github
>
> --
> You received this question notification because you asked the question.
>