Scripts2026年5月20日·1 分钟阅读

AutoHotkey — Desktop Automation and Scripting for Windows

AutoHotkey is a free scripting language for Windows that lets you create hotkeys, remap keys, automate repetitive tasks, and build lightweight GUIs with minimal code.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
AutoHotkey Overview
通用 CLI 安装命令
npx tokrepo install 62279cf5-5447-11f1-9bc6-00163e2b0d79

Introduction

AutoHotkey (AHK) is a scripting language and interpreter for Windows that enables keyboard shortcuts, macro creation, mouse automation, and custom GUI building. It is widely used by developers, power users, and gamers to automate repetitive tasks, remap keys, and extend the Windows desktop beyond what built-in tools allow.

What AutoHotkey Does

  • Creates global hotkeys and keyboard shortcuts that work across all applications
  • Remaps any key or mouse button to any other key, combination, or script action
  • Automates GUI interactions by sending keystrokes, mouse clicks, and window commands
  • Builds lightweight native Windows GUIs with buttons, text fields, and menus
  • Performs text expansion to replace short abbreviations with longer phrases

Architecture Overview

AutoHotkey v2 is an interpreter written in C++ that executes .ahk script files. Scripts register hotkeys and hotstrings through Windows hooks (keyboard and mouse low-level hooks). When a registered trigger fires, the interpreter runs the associated script block. GUI creation uses the native Win32 API, keeping the runtime footprint small. Scripts can call Windows DLL functions directly via DllCall, interact with COM objects, and manipulate windows through the built-in WinTitle matching system.

Self-Hosting & Configuration

  • Install the interpreter via WinGet, Chocolatey, Scoop, or the official installer
  • Scripts are plain text .ahk files editable in any text editor
  • Place scripts in the Windows Startup folder for automatic execution at login
  • Compile scripts into standalone .exe files with the included Ahk2Exe compiler
  • Use #Include directives to organize larger scripts across multiple files

Key Features

  • Hotkeys and hotstrings respond instantly through low-level Windows input hooks
  • DllCall and ComObject support enables deep Windows system integration
  • Ahk2Exe compiles scripts into standalone executables that run without AHK installed
  • Regular expressions, file I/O, and networking are built into the language
  • Large community library of scripts for window management, text processing, and productivity

Comparison with Similar Tools

  • PowerShell — system administration shell with deeper OS management; AHK specializes in input automation and hotkeys
  • AutoIt — similar Windows automation language; AHK has a more active community and stronger hotkey support
  • PowerToys — GUI-based utilities from Microsoft; AHK offers programmable automation beyond predefined tools
  • xdotool (Linux) — X11 automation tool; AHK is Windows-specific but offers a richer scripting language

FAQ

Q: Does AutoHotkey work on macOS or Linux? A: No. AutoHotkey is Windows-only. On macOS, consider Hammerspoon. On Linux, consider xdotool or sxhkd.

Q: What is the difference between AHK v1 and v2? A: AHK v2 is a significant rewrite with cleaner syntax, consistent function-based commands, and removed legacy behaviors. New scripts should use v2.

Q: Can AutoHotkey scripts be compiled to run without installation? A: Yes. The Ahk2Exe compiler packages scripts into standalone .exe files.

Q: Is AutoHotkey detected as malware by antivirus software? A: Some antivirus tools flag AHK scripts or compiled executables as potentially unwanted due to their input-hooking nature. These are false positives for legitimate scripts.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产