Run Python script quickly via HotKey

大兔子大兔子 提交于 2019-12-11 09:06:51

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/48042158/run-python-script-quickly-via-hotkey

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!