1

I want to make a hotkey that only exists while another key is pressed. Ordinarily, just using modifiers would work but i need to intercept specific keys while one is down so that the keys work in normal use. How do i do that?

1 Answer 1

3
~l & b::Send R

Sends R when l and b is pressed (though you'd probably want to add a {backspace} to remove the l, if you wanted such a thing for some reason)

It's the ~ that tells AHK "Don't overwrite whatever this does at the moment" that's important.

edit: GetKeyState:

r::
if getkeystate("q")
{
Send, Q and R Party YEAH!
}
else
send r
return

would fire off a lovely string if r and q are pressed. The upshot of this is you can have as many ifs as you like :)

2
  • Here's the problem: I'm trying to emulate the behavior of win+tab (keep down windows key so that the filp3d view doesn't go away), so that i can ctrl+scroll to wintab.
    – RCIX
    Commented Sep 5, 2009 at 2:28
  • right, well the function getkeystate("key") can be used to give hotkeys conditional meanings, I'll edit the post so I have codetags
    – Phoshi
    Commented Sep 5, 2009 at 11:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .