Ahk2Exe Documentation

repository·master·Indexed 21 days ago

https://github.com/autohotkey/ahk2exe

The official AutoHotkey script-to-EXE converter for converting AutoHotkey v1.1 and v2+ scripts into standalone executable (.exe) files. Includes instructions for compiling the tool and a reference for compilation error codes.

Tokens
1.5K
Snippets
2
Records
3
Agent score
24%

What's inside Ahk2Exe

  1. How to compile Ahk2Exe

    master

    Because Ahk2Exe uses compiler directives, it must be compiled using itself. To compile the project:

    1. Ensure you have a recent, self-contained AutoHotkey v1.1 binary installed (or available) to provide necessary Base files.
    2. Unpack all source files.
    3. Run Ahk2Exe.ahk.
    4. Drag and drop Ahk2Exe.ahk onto the converter window.
    5. Configure the Base compiler directive:
      • Use the embedded option to automatically select a suitable Base file from your installed AutoHotkey.
      • Or, manually select a suitable v1.1 32-bit Unicode Base file.
    6. Press the Convert button.
    7. Post-compilation: Copy the resulting Ahk2Exe.exe to the Compiler sub-folder located within the directory containing your AutoHotkey.exe to ensure proper operation.
    # Steps summary:
    1. Run Ahk2Exe.ahk
    2. Drag Ahk2Exe.ahk onto the window
    3. Select Base file
    4. Click 'Convert'
    5. Move Ahk2Exe.exe to [AutoHotkey_Folder]/Compiler/
  2. Reference the Ahk2Exe error codes

    master

    Ahk2Exe uses a categorized error code system to indicate the result of a compilation attempt. Error codes are grouped by their prefix (e.g., 0x10+ for syntax errors, 0x30+ for file access issues). A code of (0x0) indicates a successful compilation.

    ### (0x00+) General
    - (0x0) Compilation was successful.
    - (0x1) Error: Unknown error.
    - (0x2) Compilation was cancelled.
    - (0x3) Error: Bad parameters
    
    ### (0x10+) Syntax
    - (0x1) Error: The script contains syntax errors.
    - (0x2) Error: Invalid "FileInstall" syntax found. Note that the first parameter must not be specified using a continuation section.
    
    ### (0x20+) Not supported & AutoHotkey version dependent
    - (0x1) Error: #DerefChar is not supported.
    - (0x2) Error: #Delimiter is not supported.
    - (0x3) Error: /NoDecompile is not supported.
    - (0x4) Error: Password protection is not supported.
    - (0x5) Error: The AutoHotkey build used for auto-inclusion of library functions is not recognized.
    - (0x6) Error: Legacy AutoHotkey versions (prior to v1.1) can not be used to do auto-inclusion of library functions.
    - (0x7) Error: Cursor resource adding is not supported yet.
    
    ### (0x30+) File open & Not found
    - (0x1) Error: Error opening the destination file.
    - (0x2) Script or #include cannot be opened.
    - (0x3) Error: Source file not specified.
    - (0x4) Error: The selected Base file does not exist.
    - (0x5) Error changing icon: File does not exist.
    - (0x6) Error: Specified resource does not exist.
    
    ### (0x40+) File write
    - (0x1) Error: Unable to copy Base file to destination.
    - (0x2) Error changing icon: Unable to read icon or icon was of the wrong format.
    - (0x3) Error adding script file
    - (0x4) Error adding FileInstall file
    - (0x5) Error: Could not move final compiled binary file to destination.
    - (0x6) Error adding resource.
    
    ### (0x50+) Miscellaneous
    - (0x1) Call to AutoHotkey has failed, Error code is n
    - (0x2) Error: Cannot find AutoHotkey help file!
    - (0x3) Error: Invalid codepage parameter was given.
    - (0x4) Error: Cannot determine AutoHotkey vintage.
    
    ### (0x60+) Compiler directives
    - (0x1) Could not change executable subsystem.
    - (0x2) Command failed with RC=n.
    - (0x3) Error: Invalid directive.
    - (0x4) Error: Wrongly formatted directive.
    - (0x5) Error: Resource language must be an integer between 0 and 0xFFFF.
    - (0x6) Error: Impossible BMP file.
    - (0x7) Error: changing the version information.
    - (0x8) Error: 'Obey' directive cannot be executed.