问题描述
我正在尝试为某些常见任务设置 AutoHotkey 宏,我希望将热键设置为模仿Visual Studio的两步快捷方式"行为-即按-将启用宏模式";在宏模式下,按某些键将运行一个宏,然后禁用宏模式",而其他任何键都将仅禁用宏模式.
I'm trying to set up AutoHotkey macros for some common tasks, and I want the hotkeys to mimic Visual Studio's "two-step shortcut" behaviour - i.e. pressing - will enable "macro mode"; within macro mode, pressing certain keys will run a macro and then disable 'macro mode', and any other key will just disable macro mode.
示例-输入文件名时,我希望能够通过点击-,然后按来插入今天的日期.
Example - when typing a filename, I want to be able to insert today's date by tapping -, then pressing .
有人能很好地说明有状态的AutoHotkey脚本的行为吗?
Does anyone have a good example of a stateful AutoHotkey script that behaves like this?
推荐答案
当您按 + 时,此自动热键脚本将等待您按一个键然后按,它将输入当前日期.
This Autohotkey script, when you press +, will wait for you to press a key and if you press , it will input the current date.
^k::
Input Key, L1
FormatTime, Time, , yyyy-MM-dd
if Key = d
Send %Time%
return
这篇关于如何模仿Visual Studio的"Ctrl-K,C"使用Autoit/Autohotkey的两步宏行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!