After installing pip AHK on your Python and running your first Python wrapper program, you end up getting the following error while compiling it.
Traceback (most recent call last): File "C:\WebServer\python3\project\selfclick.py", line 4, in <module> ahk = AHK() File "C:\WebServer\python3\Lib\site-packages\ahk\window.py", line 630, in __init__ super().__init__(*args, **kwargs) File "C:\WebServer\python3\Lib\site-packages\ahk\mouse.py", line 61, in __init__ super().__init__(**kwargs) File "C:\WebServer\python3\Lib\site-packages\ahk\gui.py", line 12, in __init__ super().__init__(*args, **kwargs) File "C:\WebServer\python3\Lib\site-packages\ahk\script.py", line 89, in __init__ self.executable_path = _resolve_executable_path(executable_path) File "C:\WebServer\python3\Lib\site-packages\ahk\script.py", line 49, in _resolve_executable_path raise ExecutableNotFoundError( ahk.script.ExecutableNotFoundError: Could not find AutoHotkey.exe on PATH. Provide the absolute path with the `executable_path` keyword argument or in the AHK_PATH environment variable. You may be able to resolve this error by installing the binary extra: pip install "ahk[binary]"
To fix up everything, first you must install the proper program for AHK for Python
python -m pip install ahk python -m pip install "ahk[binary]"
After that, you have to download the official AutoHotKey executable program from their official website at https://www.autohotkey.com/download/2.0/. As much as possible, use the latest version, you may use 64-bit version like “AutoHotkey_v2.0-a075_x64”.
Next, extract the AutoHotkey.exe on your Python directory, in our case, its C:\WebServer\python3. If this will not work, you need to add it on the Path directory of your Windows System Environment Variables.
Everything should work now and allows you to play AHK with your python program. Cheers!