分享

Autohotkey学习笔记(四)

 小K记 2020-05-10

这篇文章主要总结关于Autohotkey的热键方式。

  • 第一种 定义系统热键

!1::msgbox,1

这种方式最常用。

  • 第二种 热字串定义热键

::aa::

msgbox,1

return

这种定义热键的方式和第一种方式并不完全相等。比如,可以用两个相同的字母作为热键,而且不影响按下单个字母。但是不能用复合键。还可以多行替换:

::text1::

(

Any text between the top and bottom parentheses is treated literally, including commas and percent signs.

By default, the hard carriage return (Enter) between the previous line and this one is also preserved.

    By default, the indentation (tab) to the left of this line is preserved.

See continuation section for how to change these default behaviors.

)

第三种 创建hotkey

Hotkey, KeyName [, Label, Options]

这一种和第一种基本完全相同,比起第一种,第二种更有利于热键的维护,把热键堆砌在一个地方,这样热键比较多的脚本,看起来就会更清晰,修改也方便。在这里还可以为热键创建其他条件,比如什么时候开,什么时候关掉。这是让热键变成变量的方法。结合Gui Add, Hotkey可以提供和用户交互的热键更改方式。

第四种 利用KeypressOSD

KeypressOSD是一个即时显示按键在电脑屏幕的库。利用它可以检测键盘按键,并能做一个标签跳转。以这种方式也能作为热键使用。

相关说明:

[AHK]那些抑制符号的分别作用

    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多