如何模仿Visual Studio的"Ctrl-K,C"使用Autoit/Autohotkey的两步宏行为? [英] How can I mimic Visual Studio's "Ctrl-K, C" two-step macro behaviour using Autoit / Autohotkey?

查看:110
本文介绍了如何模仿Visual Studio的"Ctrl-K,C"使用Autoit/Autohotkey的两步宏行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为某些常见任务设置 AutoHotkey 宏,我希望将热键设置为模仿Visual Studio的两步快捷方式"行为-即按 Ctrl - K 将启用宏模式";在宏模式下,按某些键将运行一个宏,然后禁用宏模式",而其他任何键都将仅禁用宏模式.

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 Ctrl-K 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.

示例-输入文件名时,我希望能够通过点击 Ctrl - K ,然后按 D 来插入今天的日期.

Example - when typing a filename, I want to be able to insert today's date by tapping Ctrl-K, then pressing D.

有人能很好地说明有状态的AutoHotkey脚本的行为吗?

Does anyone have a good example of a stateful AutoHotkey script that behaves like this?

推荐答案

当您按 ctrl + k 时,此自动热键脚本将等待您按一个键然后按 d ,它将输入当前日期.

This Autohotkey script, when you press ctrl+k, will wait for you to press a key and if you press d, 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的两步宏行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆