Declares the script's application name and metadata, icon, GUI theme, console mode, hook mutex name and embedded files.
#App { Key: Value, ... }
Key names are case-insensitive. Every value must be a compile-time constant: a quoted string, a number, true/false, a . concatenation of constants, or an array of them. An unknown key, a malformed value, or a missing Icon/Files path is a compile-time error.
| Key | Value | Meaning |
|---|---|---|
| Name | String | The assembly name, read by App.Name. Without it, the name is taken from the script's file name. |
| Title, Description, Configuration, Company, Product, Copyright, Trademark | String | The matching .NET assembly attribute on compiled output, readable at run time through the matching App property. |
| Version | String | "major.minor[.build[.revision]]", with 2 to 4 decimal components each from 0 through 65534. Sets both the assembly and the file version, so it also appears in a compiled executable's Explorer properties. |
| Icon | String | Relative path to a .ico file. It is the default icon of the main window, every GUI and the tray (unless #TrayIcon selects another), and the file icon of a compiled executable on Windows. |
| GuiTheme | String | Classic, System or Dark: the initial A_GuiTheme, which also applies to error dialogs shown before or during the auto-execute section, but not to compile-time errors. |
| ConsoleApp | Boolean | Builds a compiled executable as a console application, so a shell waits for it and its standard streams are the terminal's, as the Ahk2Exe ConsoleApp directive does. It affects only a Windows executable. |
| HookMutexName | String | The name of the mutex objects used to detect keyboard and mouse hooks in other scripts. The default is Keysharp. |
| DesktopEntry | String | The installed Linux desktop file name, with or without its .desktop suffix. It selects each Wayland window's application ID and the application-wide Taskbar target. The DESKTOP_ENTRY environment variable overrides it; without either setting, Keysharp uses keysharp.desktop. |
| Files | Array of Strings | Relative paths of files embedded into the compiled script for FileInstall to extract. * and ? wildcards are allowed in the file-name segment only. Only listed files are embedded. |
One or more #App blocks may appear at the top level of the main module. Blocks and their keys are applied in source order, so the last value for a repeated key wins; Files: [] clears an earlier file list. A block in an #Included file counts as the main module's; one inside a function, a class, a #Module or an #Imported module file is an error. Each block uses ordinary object-literal syntax, so it may span multiple lines and carry comments and trailing commas.
Icon and every Files entry must be relative; a rooted path is a compile-time error. Each path resolves against the main script's directory, even when the block comes from an included file.
These settings take effect before the script creates any window, dialog or tray icon, wherever the block appears. A compiled script carries them as the JSON resource Keysharp.App.json, which external tools can read without running the script.
App, FileInstall, #TrayIcon, TraySetIcon, #SingleInstance, #NoTrayIcon, #ErrorStdOut, Keysharp Build Directives, Compiling a Script
A tool that ships as a dark-themed, single-instance executable with its own icon and a bundled data file.
#SingleInstance Force
#App {
Name: "Snippets",
Title: "Snippet Manager",
Version: "1.0.0",
Icon: "snippets.ico",
GuiTheme: "Dark",
DesktopEntry: "com.acme.Snippets",
Files: ["snippets-default.json"],
}
if !FileExist(A_AppData "\Snippets\snippets.json")
FileInstall("snippets-default.json", A_AppData "\Snippets\snippets.json")