2

I've created a simple script that executes a "moving mouse and keyboard" sequence. Although currently to get this to work I use a Shell (Idle) to run and that is to slow with boot up time and such.

Is there a way to have this python file on desktop och with a hotkey swiftly run the code? I tried doing it through terminal but it doesn't like my module.

Some info: This is for both mac and windows.

The module I imported is pyautogui from PyPi and it works in the shell.

Thank you in advance!

Alvarsson
  • 115
  • 3
  • 7
  • What's your operating system? – ubadub Dec 31 '17 at 11:45
  • what if you run a python keylogger program in background which detects the hotkey and then calls your script? making a python keylogger is easy and with some modifications you can make it detect you hotkey. – M2skills Dec 31 '17 at 11:53
  • Alright, so a keylogger would allow for quick response time between hotkey-press and running och script? @M2skills – Alvarsson Dec 31 '17 at 12:11
  • I believe so, simply import your script into the keylogger script and as soon as the hotkey is detected it would execute the code so the delay should be minimum as your keylogger script is already running. – M2skills Dec 31 '17 at 12:55
  • Check Out Here: [Click Here to Check](https://stackoverflow.com/a/62631550/10367163) – Be Champzz Jun 29 '20 at 05:10
  • Check Out here , This is what you need : [Click Here](https://stackoverflow.com/a/62631550/10367163) – Be Champzz Jun 29 '20 at 05:11

1 Answers1

0

Some things to consider when trying to setup a hotkey to successfully execute any kind of command:

Each Operating System has its own ways to setup hotkeys and sometimes this may differ between distributions as well as between desktop managers.

Many of the relevant how-to-descriptions are easily found via regular search machines as Google.

If you would in fact like your script to set-up its own hotkeys you would have to re-write it in such a manner that it can detect the current operating system/distribution/desktop manager by itself and execute the commands relevant to that particular set-up.

Montmons
  • 1,416
  • 13
  • 44