KeyWait
ing is showed in the other answer, I'd like to show the other option, which is using #If
.
You create a context sensitive hotkey by setting whatever condition with the #If
directive.
In your case you'd want to check if the first key(s) of your hotkey is/are held down.
And then you'd set the last keys as a hotkey.
#If, GetKeyState("Ctrl") ;start of context sensitive hotkeys
8 & 9::
MsgBox, % "Ctrl + 8 + 9 held down"
return
#If ;end of context sensitive hotkeys
;example of holding down even more keys
;is only going to work if your system can
;recognize this many keys at once
#If, GetKeyState("Ctrl") && GetKeyState("1") && GetKeyState("2") && GetKeyState("3") && GetKeyState("4") && GetKeyState("5")
6 & 7::
MsgBox, % "Ctrl + 1 + 2 + 3 + 4 + 5 + 6 + 7 held down"
return
#If
Whether or not I'd recommend this approach is another thing.
If your script is just about simple hotkeys or something like that, this is a very good approach.
But if your script is more complex than that, you might run into the problems #If
can cause. More about that from the documentation.
Basically, just try it out and if you have problems, maybe consider another approach.