I would like to create a hotkey where a key combination is pressed, but nothing happens unless and until another specific key is pressed. Basically, the equivalent of what in Microsoft Word would be a macro trigger like: Alt+s,s
I know that's possible, or at least I think it is, but I'm not seeing how to do it.
Thanks.
Two-part hotkey
Re: Two-part hotkey
There are various solutions, see "CHORDING / MORSE-CODE" at http://www.autohotkey.net/~faqbot/typing-scripts.html - the problem is that not all the links work but if you Google the title between "" e.g. "Detect Ctrl+K followed by Ctrl+P by transforming Ctrl-characters" you should find the correct post on ahk . com - try the link first, if it fails search for it.
Re: Two-part hotkey
Try this:
Code: Select all
!s::
If !(A_PriorHotkey=A_ThisHotkey && A_TimeSincePriorHotkey<300)
return
MsgBox Hotkey !ss
return
Re: Two-part hotkey
what about this?
Code: Select all
!s::
Input, key, L1
if (key = "s")
msgbox, you pressed Alt+S and then S
else if (key = "x")
msgbox, you pressed Alt+S and then X
;//etc
return
Re: Two-part hotkey
Thank you. This works nicely as written.guest3456 wrote:what about this?
Code: Select all
!s:: Input, key, L1 if (key = "s") msgbox, you pressed Alt+S and then S else if (key = "x") msgbox, you pressed Alt+S and then X ;//etc return
But when I comment out the first msgbox, and put in the commands I want to send, it immediately sends the Alt-s to focused application (which I don't mind overriding) rather than waiting for the second keypress. The keys I want to send to the focused app are:
Code: Select all
Send {LEFT 1}s{RIGHT 1}
Who is online
Users browsing this forum: roysubs and 286 guests