问题
I want every time the series Ctrl GUpEnter and Ctrl GDownEnter are pressed, it will Send !wi
afterward. Normal hotkeys work:
~^PgUp::
~^PgDn::Send !wi
But this doesn't work, although ~^g down enter
isn't an invalid hotkey:
~^PgUp::
~^PgDn::
::~^g down enter::
::~^g up enter::Send !wi
Also, since I don't know many times Up and Down will be pressed before Enter, is there a way to make it skips the middle keys?
回答1:
Try:
~^PgUp::
~^PgDn::Send !wi
~^g::
Input, key, V L1, {Enter}
if (ErrorLevel == "EndKey:Enter")
Send {Enter}!wi
return
回答2:
A simple solution is to set a boolean flag when ^g
is pressed. Then check this flag when enter
is pressed and fire !wi
if it is set. This however require that the flag is reset - so if some other key can end the sequence, it must be also reset by those keys (see bottom section of code for examples).
await := 0
~^g::
await := 1 ; set flag
tooltip %await%
return
~enter::
if (await = 1) {
await := 0 ; reset flag
sleep 300 ; safety pause
send !wi
tooltip %await%
}
return
; note: the 'await' flag must be reset if other
; key can end the sequence.
; here for example escape or mouse click
~esc::
await := 0
tooltip %await%
return
~lbutton::
await := 0
tooltip %await%
return
来源:https://stackoverflow.com/questions/51165720/how-to-send-an-addition-sequence-after-a-series-of-input