The script compiler accepts certain directives that allow you to further customize the compiled script (.exe).
It is possible to remove code sections from the compiled script by wrapping them in directives:
MsgBox This message appears in both the compiled and uncompiled script ;@Ahk2Exe-IgnoreBegin MsgBox This message does NOT appear in the compiled script ;@Ahk2Exe-IgnoreEnd MsgBox This message appears in both the compiled and uncompiled script
The reverse is also possible, i.e. marking a code section to only be executed in the compiled script:
/*@Ahk2Exe-Keep MsgBox This message appears only in the compiled script */ MsgBox This message appears in both the compiled and uncompiled script
This has advantage over A_IsCompiled because the code is completely removed from the compiled script during preprocessing, thus making the compiled script smaller. The reverse is also true: it will not be necessary to check for A_IsCompiled because the code is inside a comment block in the uncompiled script.
In the parameters of these directives, the following escape sequences are supported:
Commas always need to be escaped, regardless of the parameter position.
"Integer" refers to unsigned 16-bit integers (0..0xFFFF).
Changes a property in the compiled executable's version information.
|Prop||The name of the property to change. Must be one of below.|
|Value||The value to set the property to.|
The following properties are supported:
|Name||Changes the product name and the internal name.|
|Description||Changes the file description.|
|Version||Changes the file version, the product version, in both text
and raw binary format. Ahk2Exe fills the binary version fields with the period-delimited numbers (up to four)
that may appear at the beginning of the version text. Unfilled fields are set to zero. For example,
|Copyright||Changes the legal copyright information.|
|OrigFilename||Changes the original filename information.|
|CompanyName||Changes the company name.|
Overrides the custom EXE icon used for compilation.
|IcoFile||(Optional) The icon file to use. If omitted, the default AutoHotkey icon is used.|
Specifies a command to be executed after a successful compilation.
|Command||The command to execute.|
When a custom icon is specified, the presence of this directive reenables the usage of the separate Tray icon resource (which can then be replaced with something custom).
Changes the executable subsystem to Console mode.
Adds a resource to the compiled executable.
;@Ahk2Exe-AddResource FileName [, ResourceName]
|FileName||The filename of the resource to add. The type of the resource
(as an integer or string) can be explicitly specified prepending an asterisk to it: |
|ResourceName||(Optional) The name that the resource will have (can be a string or an integer). If omitted, it defaults to the name (with no path) of the file, in uppercase.|
Here is a list of common standard resource types and the extensions that trigger them by default.
.cur(not yet supported)
.ico(not yet supported)
.manifest. If the name for the resource is not specified, it defaults to
Changes the resource language used by
|LangCode||The language code. Please
note that hexadecimal numbers must have an |
The default resource language is US English (0x0409).