Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a standalone exe with AutoHotkey?

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?

like image 426
rubo77 Avatar asked Apr 22 '14 01:04

rubo77


People also ask

What is AutoHotkey exe?

AutoHotkey is a free and open-source custom scripting language for Microsoft Windows, initially aimed at providing easy keyboard shortcuts or hotkeys, fast macro-creation and software automation that allows users of most levels of computer skill to automate repetitive tasks in any Windows application.

What is Ahk2Exe exe?

Ahk2Exe is the official AutoHotkey script to EXE converter, which is written itself in AutoHotkey.

Can you run AutoHotkey without installing?

And that's just how simple it is to use the portable version of AutoHotkey; you can use it on any computer without installing!


2 Answers

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.

like image 120
cf stands with Monica Avatar answered Sep 29 '22 19:09

cf stands with Monica


Just want to add that, quoting from Convert a Script to an EXE (Ahk2Exe):

Once a script is compiled, it becomes a standalone executable; that is, AutoHotkey.exe is not required to run the script. The compilation process creates an executable file that contains the following: the AutoHotkey interpreter, the script, any files it includes, and any files it has incorporated via the FileInstall command. [v1.1.33+]: Additional files can be included using compiler directives.

like image 32
Wenfang Du Avatar answered Sep 29 '22 19:09

Wenfang Du