I have a hotkey and hotstring that don't seem to work together:
9::(
:?ob0:(::){left 1}
To give some context, in one part of the code I remapped all the symbols to the number below them and vice versa so 9
prints the parenthesis (
. Later on I put a hotstring that would type a closed parenthesis after an open one and then places the cursor in between.
Seems simple enough because they both work individually but together when I press the key for 9
and press the Spacebar I only get the open parenthesis (
as if the hotstring was ignored.
Am I missing something obvious?
Try using a combination of Send
and InputLevel
.
#InputLevel 1
9::SendEvent (
#InputLevel 0
;; Add closing parenthesis
:?ob0:(::){left 1}
Explanation
#InputLevel
- By default, hook hotkeys and hotstrings ignore keyboard and mouse events generated by any AutoHotkey script. This behavior can be overridden using SendLevel or #InputLevel
- By setting the
9
hotkey to a higher InputLevel, it is able to the activate other hotstrings.
SendEvent
- Bizarrely, remapping a numkey to its Shift+# equivalent produced no input when
#InputLevel 1
was active.
- i.e. Couldn't use
1::!
, 2::@
, 3::#
, ..., 8::*
, 9::(
, etc.
- A Send command was used to workaround this remapping limitation
- By default,
Send
and SendEvent
are synonymous with each other.
Notes
- SendPlay is not affected by InputLevel.
- Remarks for Remapping Keys may explain why
9::(
wouldn't trigger other hotkeys.
- "Although a remapped key can trigger normal hotkeys, by default it cannot trigger mouse hotkeys or hook hotkeys."
Related
#InputLevel, Send, Remapping (Remarks)