How do I create a standalone exe with AutoHotkey?

rubo77 picture rubo77 · Apr 22, 2014 · Viewed 31.8k times · Source

I have created a script to remap the Windows Button to right-mouseclick.

How can I create an executable AutoHotkey file that I can offer for download, that automatically runs only that script?

Answer

cf stands with Monica picture cf stands with Monica · Apr 22, 2014

Why not use Ahk2exe? According to its docs, you can use it in three ways:

  1. GUI Interface: Run the "Convert .ahk to .exe" item in the Start Menu.
  2. Right-click: Within an open Explorer window, you can right-click any .ahk file and select "Compile Script" (only available if the script compiler option was chosen when AutoHotkey was installed). This creates an EXE file of the same base filename as the script, which appears after a short time in the same directory. Note: The EXE file is produced using the same custom icon, .bin file and use MPRESS setting that were last used by Method #1 above.
  3. Command Line: The compiler can be run from the command line with the following parameters:

    Ahk2Exe.exe /in MyScript.ahk [/out MyScript.exe] [/icon MyIcon.ico] [/bin AutoHotkeySC.bin] [/mpress 0or1]
    

    For example:

    Ahk2Exe.exe /in "MyScript.ahk" /icon "MyIcon.ico"
    

    Usage: Parameters containing spaces should be enclosed in double quotes. If the "out" file is omitted, the EXE will have the same base filename as the script itself.