AutoHotkey

维基百科,自由的百科全书
跳转到导航 跳转到搜索
AutoHotkey
File:AutoHotkey logo.png
开发者Chris Mallett(Chris),Steve Gray(Lexikos)
首次发布2003年11月10日 (2003-11-10)
当前版本
    Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
    源代码库
    • {{URL|example.com|可选的显示文本}}
    Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
    编程语言C++
    引擎
      Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
      操作系统Microsoft Windows
      语言英语
      类型脚本语言自动化GUI
      许可协议GPL
      网站www.autohotkey.com

      AutoHotkey自由开源的编程语言,常用于Windows平台的自动化。[1]

      AutoHotkey 能快速编写的功能[编辑]

      • 启动程序,打开文件
      • 获得或产生系统状态,音量(状态,调节),搜索屏幕上的图像或像素(获得坐标),鼠标(位置,悬停视窗对象,移动),键盘(热键(快捷键),热字符串(键盘输入序列),上下文热键),游戏杆按钮
      • 创建图形用户界面
      • 剪贴板操作,程序窗口操作

      历史[编辑]

      AutoHotkey Basic时期,官方网站为www.autohotkey.com页面存档备份,存于互联网档案馆)。当Chris Mallett(原作者)停止更新时宣布AutoHotkey_L为后续主分支。[2]不久网站转由polyethene管理,他对网站的决定与论坛中许多核心用户出现较大分歧[3][4]且不时失去联系并成立了公司确保其正常运营。[5][6][7]2014年4月成立了 AutoHotkey Foundation 以确保AutoHotkey自由开放、持续开发,并提供组织、法务和财政上的支持。[8]

      版本历史[编辑]

      • AutoHotkey Basic:Chris Mallett 提议在AutoIt v2中集成热键支持未得到AutoIt社区响应后,于2003年11月10日公开发布了AutoHotkey的首个测试版本。[9][10][11]作者以AutoIt v2的语法为基础并在一些命令和编译器中使用AutoIt v3的源码开始编写自己的程序。[12]随后,AutoIt v3的许可从GPL切换为闭源,作者给出的原因是“某些项目重复窃取AutoIt的代码”和“建立了竞争者”。[13]
      • AutoHotkey_L:2010年10月10日,原作者在停止更新一年多后表示“失去了兴趣”并声明AutoHotkey_L为正在开发的分支,并把它放置在网页的下载部分的前面。[14]同时把原来的版本称为 AutoHotkey Basic。[15]比起AutoHotkey Basic,AutoHotkey_L中增加了UnicodeCOM对象调试特性和其他功能。[16]

      主要分支[编辑]

      • AutoHotkey 1.0.* - 被称为 AutoHotkey Basic 或者 AutoHotkey Classic 或者 AutoHotkey Vanilla[17]
      • AutoHotkey_H[18] 是由 HotkeyIt 合并了原有AutoHotkey.dll 并在 AutoHotkey_L 及 AutoHotkey v2 的基础上开发的分支。
      • AutoHotkey_L 主要由 Lexikos 在 AutoHotkey Basic 基础上开发的分支[16],但是现在已经变成(也被称为) AutoHotkey 1.1.*页面存档备份,存于互联网档案馆) 的主要版本。[17]
      • AutoHotkey v2[19] 由 Lexikos 基于AutoHotkey_L代码开发,已于2022年12月20日正式发布,语法不完全兼容 AutoHotkey_1.1.*。[20][21]2023年1月22正式成为官方的默认版本。[1]页面存档备份,存于互联网档案馆

      应该选择哪个版本[编辑]

      AutoHotkey 1.0.* 和 AutoHotkey_H 已停止开发和维护,不建议使用。

      依赖大量旧的代码库建议使用 AutoHotkey 1.1.*,因为目前绝大多数的代码和社区都是使用这个版本,这个版本仍在维护,仍然会添加少量的新功能和修复错误,用户可以等待迁移工具完善或者 v2 变成主流再迁移即可。

      不依赖旧的代码库,愿意且能够同步改动代码的用户使用 AutoHotkey v2,能获得更一致的语法和更多的新功能。另外从v2 beta 4版本开始,v2和v1.1可以在同一台电脑上共存,v2 beta 15 已能自动从代码来决定以哪个版本的引擎来运行,也有提供安装工具,无需手动编译或设定。

      常用的辅助工具[编辑]

      • 中文和英文文档[22][23]
      • Window Spy(自带):获得当前窗口或控件的进程的接口细节。
      • ahk2exe(Convert .ahk to .exe)(自带):脚本编译器,把 ahk 脚本转换成可执行文件。
      • SciTE4AutoHotkey页面存档备份,存于互联网档案馆):基于 SciTE 的代码编辑器,功能包含语法高亮、自动补全、一键运行脚本、GUI 工具等。
      • GUI Creator[24]:在图形界面中为AutoHotkey脚本创建GUI的工具。
      • Pulover's Macro Creator[25]:图形化宏录制工具和自动化工具。
      • iWB2 Learner[26]:从IE中获取网页元素信息的工具,编写COM自动化操作IE的工具。
      • VSCode 上的相关插件:提供语法高亮,文档格式化等功能。

      代码示例[编辑]

      快捷键(热键)

      让左边的 ⊞ Win键失效

      LWin::Return
      

      搜索剪贴板的内容

      Alt & g::Run http://www.google.com/search?q=%clipboard%
      

      热字符串(序列键)[27]示例:依次按下wjbk 输入维基百科

      ::wjbk::维基百科,自由的百科全书
      

      按下rn 打开记事本

      ::rn::Run, Notepad
      

      另请参阅[编辑]

      参考资料[编辑]

      1. ^ Prevent RSI with AutoHotkey. cedeq.com. [2014-03-02]. (原始内容存档于2014-03-02). 
      2. ^ Chris. My status and website changes. AutoHotkey.com. [2014-06-15]. (原始内容存档于2014-10-09). 
      3. ^ polyethene. Changes for AutoHotkey website. AutoHotkey.com. [2014-06-15]. (原始内容存档于2014-10-09). 
      4. ^ sumon. Make AHK_L "main" version?. AutoHotkey.com. [2014-06-15]. (原始内容存档于2014-07-14). 
      5. ^ tidbit. Basics as to why AHKSCRIPT exists. ahkscript.com. [2014-06-15]. (原始内容存档于2014-07-27). 
      6. ^ The AutoHotkey Foundation. ahkscript.org. [2014-06-15]. (原始内容存档于2014-06-25). 
      7. ^ tank. Welcome and if you need help. ahkscript.org. [2014-06-15]. (原始内容存档于2014-07-14). 
      8. ^ The AutoHotkey Foundation. ahkscript.org. [2014-06-29]. (原始内容存档于2014-06-25). 
      9. ^ Author Chris Mallett's post on the AutoHotkey Forums. Autohotkey.com. [2011-12-02]. (原始内容存档于2008-02-18). 
      10. ^ An AutoIt / AutoHotkey nonfunctional comparison. Paperlined.org. [2011-12-02]. (原始内容存档于2011-12-08). 
      11. ^ AutoHotkey Changelog for Years 2003-2004. Autohotkey.com. [2011-12-02]. (原始内容存档于2011-11-04). 
      12. ^ Author Chris Mallett's post on the AutoHotkey Forums. Autohotkey.com. [2011-12-02]. (原始内容存档于2008-05-26). 
      13. ^ Licensing Opinions - AutoIt Forums. Autoitscript.com. [2011-12-02]. (原始内容存档于2019-09-19). 
      14. ^ Forum post by Chris, announcing AutoHotkey_L now main platform. Autohotkey.com. [2011-12-02]. (原始内容存档于2019-09-19). 
      15. ^ Download page showing AutoHotkey_L as ongoing platform. Autohotkey.com. [2011-12-02]. (原始内容存档于2011-12-01). 
      16. ^ 16.0 16.1 AutoHotkey_L的新增特性. ahkcn.sourceforge.net. [2011-12-28]. (原始内容存档于2014-10-09). 
      17. ^ 17.0 17.1 AutoHotkey Downloads. (原始内容存档于2020-07-02). 
      18. ^ HotKeyIt. AutoHotkey_H. autohotkey.net. [2014-06-16]. 
      19. ^ AutoHotkey v2. ahkscript.org. [2014-06-15]. (原始内容存档于2014-07-09). 
      20. ^ AutoHotkey v2 Development. ahkscript.org. [2014-06-15]. (原始内容存档于2014-07-14). 
      21. ^ v2-changes. www.autohotkey.com. [2020-08-19]. (原始内容存档于2020-04-09). 
      22. ^ ahk 英文文檔. (原始内容存档于2019-10-01). 
      23. ^ ahk 中文文檔. (原始内容存档于2019-10-13). 
      24. ^ maestrith. GUI Creator. ahkscript.org. [2014-06-16]. (原始内容存档于2014-06-25). 
      25. ^ Pulover's Macro Creator. macrocreator.com. [2014-04-08]. (原始内容存档于2014-04-08). 
      26. ^ iWB2 Learner页面. [2014-04-22]. (原始内容存档于2014-04-18). 
      27. ^ 热字串和自动替换. AutoHotkey中文帮助. ahkcn.sf.net. [2014-06-16]. (原始内容存档于2014-06-03). 

      外部链接[编辑]