Changes from AutoHotkey to Keysharp

This page summarizes the structural differences between Keysharp and its AutoHotkey compatibility target, then indexes the pages which state each exact contract.

Table of Contents

Core Differences

Scripts are compiled, not interpreted

AutoHotkey interprets a script. Keysharp reads it, lowers it to C#, and has Roslyn compile it to a .NET assembly which is then executed. How a Script Executes describes the pipeline, and the --transpile and --compile options expose its intermediate results.

As a result:

Three platforms, one language

Much of the inherited library is defined in terms of Win32, and each platform meets that behavior to a different degree. Platform Support covers X11, Wayland, macOS permissions and foreign-window automation. On Linux and macOS, input and window control depend on OS-level permissions and helpers, and a script can declare what it needs with #Requires or RequestCapabilities.

On Linux and macOS, window styles, control messages and other Win32-level GUI facilities are unavailable or approximated; GUI Control Types and GUI Events record where.

A managed object model

Objects are .NET objects. Object lifetime and finalization follow the garbage collector instead of reference counting, so __Delete runs when the collector reclaims the object rather than when the last reference goes away. The reference-counting functions manage native COM references on Windows, including those of a script object's COM wrapper.

The same applies wherever a script reaches outside itself for memory: DllCall, CallbackCreate, StrPtr and ObjPtr operate on managed values, and StringBuffer is the writable string-memory type to pass to native code. For calling .NET directly, Clr is available.

Language additions

Keysharp adds:

Detailed Index

Each link below leads to the canonical contract for that behavior.

Runtime and Language

Memory and Interop

GUI and Desktop Integration

Unavailable or Reduced Inherited Behavior

The affected reference pages document the exact boundary. Notable areas include:

Version Differences

The differences above are between Keysharp and its AutoHotkey compatibility target. For changes between AutoHotkey versions themselves, see Changes from v2.0 to v2.1 and Changes from v1.1 to v2.0. For changes between Keysharp releases, see Recent Changes.