在非常简单的AHK(AutoHotKey)宏之后,如何抑制不需要的“返回"字符? [英] How do I suppress an unwanted 'return' character after very simple AHK (AutoHotKey) macro?
问题描述
我已经重新定义了数字小键盘上的所有键,以自动执行编程任务,包括剪切",粘贴"和复制".但是此宏(粘贴")失败了:
I've redefined all the keys on the numeric keypad to automate programming tasks, including 'cut, 'paste' and 'copy'. But this macro ('paste') fails:
;===== NumpadDot or NumpadDel paste
NumpadDot::
NumpadDel::
Send,^v
Return
令人惊讶的是,它发送了一个控制-v ,但随后(稍后)出现了返回/输入"键.是什么导致AHK发送了一个额外的键,以及如何防止它? –我的其他宏都没有任何问题.
Surprisingly this sends a control-v but followed (slightly later) by a 'return/enter' keystroke. What causes AHK to send an extra keystroke and how do I prevent it? – None of my other macros have any problems.
推荐答案
最后发现问题.我在每个宏之前都有这样的评论:
Finally discover the issue. I had comments before each macro like this:
;===== NumpadPgDn 3 / NumpadPgDn paste
Numpad3::
NumpadPgDn::
SetKeyDelay (150)
Send,^v
Return
;===== Numpad0 / NumpadIns to Copy
Numpad0::
NumpadIns::
Send,^c
Return
不幸的是,在其中一个注释中,我用':'(冒号)代替了';'. (分号).这会更改文件中 上一个 宏的行为,并在执行后添加Enter键.
Unfortunately in one of the comments I had a ':' (colon) in place of a ';' (semicolon). This alters the behavior of the preceding macro in the file and adds a enter keystroke after its execution.
这篇关于在非常简单的AHK(AutoHotKey)宏之后,如何抑制不需要的“返回"字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!