I have recently attempted, and after some effort managed, to compile a python ahk script to a standalone single file exe using nuitka.
Heres the process:
- Install nuitka
- Copy your AutoHotkey.exe into the same folder as your script
- Use this code block to create your AHK instance, since when compiling to a single file with nuitka the path needs to be specified relative to
__file__
from ahk import AHK
from pathlib import Path
AHK_EXE = Path(__file__).parent / "AutoHotkey.exe"
ahk = AHK(executable_path=str(AHK_EXE))
- compile to a single file nuitka exe with the following command
py -m nuitka --include-data-file=AutoHotkey.exe=./AutoHotkey.exe --include-package-data=ahk --onefile --standalone script.py
--include-data-file will include the ahk exe in the single file app, and --include-package-data is required to include all the templates that this library uses.
I thought this might be interesting to document, since one of the best features of auto hotkey is IMO that it compiles to a standalone exe that i can share. I wasn't sure whether this is documentation that is wanted, or in what form/where, hence the issue and not a PR.
I have recently attempted, and after some effort managed, to compile a python ahk script to a standalone single file exe using nuitka.
Heres the process:
__file__--include-data-filewill include the ahk exe in the single file app, and--include-package-datais required to include all the templates that this library uses.I thought this might be interesting to document, since one of the best features of auto hotkey is IMO that it compiles to a standalone exe that i can share. I wasn't sure whether this is documentation that is wanted, or in what form/where, hence the issue and not a PR.