====== Keysharp ======
https://github.com/keysharp-org/Keysharp
Keysharp is a cross-platform C# implementation of AutoHotkey v2. It parses AutoHotkey-style scripts, compiles them through .NET, and runs them on Windows, Linux, and macOS.
> Status: under active development and not yet recommended for production. Windows has the broadest compatibility; Linux and macOS support continues to improve.
Most scripts run unmodified on Windows. Across platforms, anything using **DllCall, COM, or the registry will not work** on Linux and macOS.
===== Demos =====
[[https://github.com/user-attachments/assets/c362ccf2-f096-4d0e-960a-aef2d9ce46b5|Watch the Keysharp demos]]
See the [[https://github.com/keysharp-org/Keysharp/tree/master/demos|demos folder]] for example scripts showcasing Keysharp's cross-platform image, overlay, OCR, input and window-management APIs.
===== Quick Start =====
- Install Keysharp for your platform
- Create a script named ''hello.ks'': MsgBox("Hello from Keysharp!")
- Double-click it, or run it from a terminal: keysharp hello.ks
Keysharp runs ''.ahk''/''.ks'' source scripts and ''.cks'' compiled scripts. It also ships **Keyview**, a lightweight editor with live validation, running, and ''.cks'' compilation — open it without a file for an autosaved scratchpad.
For per-platform setup, permissions, portable/standalone runs, command-line switches, and building from source, see the [[https://github.com/keysharp-org/Keysharp/blob/master/docs/reference.md|detailed reference]].
===== Platform Compatibility =====
"Full" means the feature is generally usable; "Partial" means known gaps remain.
| Capability | Windows | Linux | macOS |
|---|---|---|---|
| Parser and script execution | Full | Full | Full |
| File and directory operations | Full | Partial | Partial |
| Hotkeys, hotstrings, and input | Full | Partial | Partial |
| GUI windows and window automation | Full | Partial | Partial |
| Screen capture and pixel functions | Full | Partial | Partial |
| Registry and COM APIs | Full | Unsupported | Unsupported |
===== Threading =====
#import Ks { RealThread }
MsgBox(s) => FileAppend(s "`n", "*")
ThreadFunc()
{
Sleep 1000
MsgBox "Background Thread"
}
theThread := RealThread(ThreadFunc) ; Create and start the thread.
MsgBox "Main Thread"
theThread.Wait() ; Wait for the thread to complete before continuing.
MsgBox "Main Thread Again"