Activate Python Scripts from Python Hotkeys with Keyboard package

Following on from earlier video ‘Activate Python Scripts from AutoHotKey V2 Hotkeys’ (https://youtu.be/QYxTI81FtWI ) I wanted to add a hotkey information help message box, so I can easily find out the hotkeys for triggering specific scripts. I find this useful when I have a lot of hotkeys and hotstrings and so I do not have to remember them all but can easily refer to them with the message box from the system tray Icon for AutoHotKeys.
In Python you do not have the system tray icon by default. So I needed to explore a few issues.


1.. How to close the program if using without command console

  1. How to run the python script without the command console ( use file extension .pyw & point to where your python.exe file is located at top line with (# ! pathto/python.exe)
  2. How to show Help information with a list of hotkeys and what they do.
  3. How to create a system tray icon in windows for the python script
  4. How to add a tray item as a pop-up message box in python so you can refer to the script hotkeys easily
  5. How to use a shortcut.lnk file and put it in the windows startup location (found by running RUN & then in run propt putting shell:startup to open file explorer in startup folder to add shortcut link.
    Resources:
    Python Keyboard Package – https://pypi.org/project/keyboard/
    Github & Documentation for Keyboard package – https://github.com/boppreh/keyboard
    You can download the files from this link:
    https://drive.google.com/drive/folders/1Gm6dMSyzs7TJ9ihuD1pu2oGcy1WTTY2P?usp=sharing

End comment

I was pleased with how the python script came out, I was able to replicate most of the features I use in AutoHotKeys Scripts so this would be a viable alternative for someone in a purely pythonic environment.

As I’m sort of wedded to AutoHotKey I will personally stick with my earlier AutoHotKey v2 script for this process and when I write my book on python I’ll use this python method for running python scripts.