title: "AutoHotkey_L:支持unicode, 能发送中文的AutoHotkey分支"
date: 2010-09-15
categories:
- "tools"
tags:
- "ahk"
AutoHotkey_L:支持unicode, 能发送中文的AutoHotkey分支
原版的 AutoHotkey 不支持 unicode ,给中文用户带来极大不便。比如,sendinput 输入中文时,必须借助剪贴板 或 自定义函数。
幸运的是,开源软件再一次带来了奇迹:早在2008年就出现了支持 unicode 的 AutoHotkey 分支——由Lexikos维护的 AutoHotkey_L。
AutoHotkey_L 是 AutoHotkey 的一个第三方分支版本,由 Lexikos 维护。主要增加和增强了对象、debug调试、unicode、64位、图标等功能。
AutoHotkey_L主页:http://www.autohotkey.net/~Lexikos/AutoHotkey_L/
== AutoHotkey_L 主要特征 ==: * Objects (extensible associative arrays). * Interactive debugging features, when used with a compatible debugging client. * Significant functionality developed by other community members: + Native 64-bit support by fincs. + Native COM support by Sean. + Native Unicode support by jackieku. + Support for various text encodings. + New DllCall arg types for portability. + Object-oriented file I/O. * #if expression - Similar to #IfWinActive, but for arbitrary expressions. * Built-in support for menu icons and improvements to icon support.
* 选择合适版本进行下载,比如我在测试中选择了Unicode x86 。 * 将解压出的 AutoHotkey.exe 覆盖原来安装的AutoHotkey.exe。 * 新建一个 test.ahk ,注意:文件编码务必选用 utf-8 。 * 复制如下代码到 test.ahk
::test1:: 善用佳软。ひらがな 平仮名;カタカナ 片仮名。Korean/한국어/조선말。
::test2:: sendinput, 善用佳软。ひらがな 平仮名;カタカナ 片仮名。Korean/한국어/조선말。 return
* 运行 test.ahk 。(此版本的AutoHotkey.exe系统托盘图标的H字符更加粗壮) * 在任何能正常显示 unicode 字符的程序中(比如浏览器的地址栏),键入 test1 test2 应该都能上屏指定的文字,即 sendinput 与 hotstring 都支持中文(unicode)了。
欢迎AutoHotkey爱好者分享此消息,也欢迎提供 AutoHotkey_L 其他功能的应用举例。 * 《一键去掉Tweets中的所有“RT”字符|陈轶的盛夏厅》:避免英文Windows下,StringReplace, clipboard ……含有中文时的乱码问题。 * 《SuperMemo生词捕捉,词库制作工具:QArabbit》:使用SuperMemo的朋友,欢迎使用AutoHotkey_L写的词库捕捉制作工具QARabbit
我在wordpress撰写或修改博文,一向是用gvim手写源代码。当然,用 AutoHotkey 实现了一键操作。但 AutoHotkey fileappend 创建的文件,fenc=cp936,偶尔会保存出错,显然不如utf-8格式方便。尽管知道AutoHotkey不支持unicode,但是否有奇迹能设定fenc呢?Google 『AutoHotkey fileappend utf-8』,第一条结果就见到 AutoHotkeyU,进入后发现,该分支已经合并到 AutoHotkey_L ,下载后测试『FileAppend, %clipboard%, %tmpfile%, UTF-8』成功,再试了上面的sendinput依然成功,于是,写出来与大家共享。
当然,事后进一步搜索发现,http://ahk.5d6d.com/ 论坛上早就有关于 AutoHotkey_L 的讨论了。由此可知:①经常有人火星,所以,需要进一步分享。②凡事可以更乐观地搜索。
-------------------------- 2010-09-14: 初稿。