问题
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