Skip to content

Convert AutoHotkey scripts to executables with Ahk2Exe

License

Notifications You must be signed in to change notification settings

tamo/action-Ahk2Exe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 

Repository files navigation

action-Ahk2Exe

Converts AutoHotkey scripts to executables using Ahk2Exe.

It downloads the latest versions of AutoHotkey and Ahk2Exe.

inputs

All optional.

  • src
    • default: "" (just install base and ahk2exe)
    • if specified, this is used as the /in option
      • this can be a comma-separated list such as a.ahk,b.ahk,c.ahk
  • taghead
    • default: v2.
    • you can use v1.1. for v1 scripts
  • base
    • default: _ahktmp/AutoHotkey32.exe
    • you can omit tmpdir for exe files
    • this can be a comma-separated list such as AutoHotkey32.exe,AutoHotkey64.exe
      • if this contains multiple files, generated files will have suffix such as 32, 64, U32, U64, or A32
      • v2 has AutoHotkey32.exe and AutoHotkey64.exe
      • v1 has AutoHotkeyU32.exe, AutoHotkeyU64.exe and AutoHotkeyA32.exe
  • opt
    • default: ""
    • mostly for /icon foo.ico
    • /out is automatically determined but opt can override it
  • tmpdir
    • default: _ahktmp
    • other values (base and ahk2exe) don't refer to this value, so if you change this you have to change them as well
  • ahk2exe
    • default: _ahktmp/Ahk2Exe.exe
    • AutoHotkey v1 is shipped with its own compiler, so you can use _ahktmp/Compiler/Ahk2Exe.exe if taghead points to v1

Examples

See ci.yml in this repo.

Simply use it with src.

jobs:
  build:
    runs-on: windows-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Ahk2Exe (32bit)
      uses: tamo/action-Ahk2Exe@main
      with:
        src: RestoreWinPos.ahk

    - run: ls RestoreWinPos.exe

Specify base to embed 64bit binary.

jobs:
  build:
    runs-on: windows-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Ahk2Exe (64bit)
      uses: tamo/action-Ahk2Exe@main
      with:
        base: AutoHotkey64.exe
        src: RestoreWinPos.ahk

    - run: ls RestoreWinPos.exe

Specify multiple targets.

jobs:
  build:
    runs-on: windows-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Ahk2Exe (multi-target)
      uses: tamo/action-Ahk2Exe@main
      with:
        src: RestoreWinPos.ahk,AnotherSource.ahk
        base: AutoHotkey32.exe,AutoHotkey64.exe

    - run: |
        ls RestoreWinPos32.exe
        ls RestoreWinPos64.exe
        ls AnotherSource32.exe
        ls AnotherSource64.exe

Do more precise work step by step.

jobs:
  build:
    runs-on: windows-latest

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Prepare Ahk2Exe without compiling anything
      uses: tamo/action-Ahk2Exe@main

    - run: |
        ls _ahktmp/Ahk2Exe
        mv _ahktmp/AutoHotkey32.exe U32.exe
        mv _ahktmp/AutoHotkey64.exe U64.exe

    - name: Compile two targets, two bitnesses
      uses: tamo/action-Ahk2Exe@main
      with:
        src: RestoreWinPos.ahk,AnotherSource.ahk
        base: U32.exe,U64.exe

    - run: |
        ls RestoreWinPosU32.exe
        ls RestoreWinPosU64.exe
        ls AnotherSourceU32.exe
        ls AnotherSourceU64.exe