AutoHotkey.py is a Python library that embeds a Python DLL into the AutoHotkey_L v1.1 process. It lets you call AHK functions from the Python code and register Python functions to be called from AHK, e.g. hotkeys, timers, clipboard handlers.
Goals of the project:
- Friendly API and improved developer experience
- Leveraging the Python ecosystem
- Compatibility with AutoHotkey down to function names
- Using AutoHotkey.py as an AHK library
Examples
Show a message box and register an F1 hotkey:
Code: Select all
import sys
import ahkpy
ahkpy.message_box("Hello!")
@ahkpy.hotkey("F1")
def bye():
ahkpy.message_box("Bye!")
sys.exit()
Code: Select all
import ahkpy
ahkpy.set_timer(0.1, lambda: ahk.windows.close_all(class_name="AnnoyingAdWindow"))