How do I suppress an unwanted 'return' character after very simple AHK (AutoHotKey) macro?

落爺英雄遲暮 提交于 2019-12-25 01:29:07

问题


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

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.


回答1:


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

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.



来源:https://stackoverflow.com/questions/58395525/how-do-i-suppress-an-unwanted-return-character-after-very-simple-ahk-autohotk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!