Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have written two functions in an AutoHotkey script: fun1() and fun2(). I now need to bind fun1() to when Pause is pressed down, and bind fun2() to when Pause is released.

As an example, I would press and hold Pause to hide all windows, and release Pause to restore all windows. (This example is not my actual objetive).

How can I do that in AutoHotkey?

share|improve this question
up vote 1 down vote accepted

You could compile your .ahk scripts as .exe. Then have

Pause Up::C:\fun2.exe

More info on .akh to .exe: autohotkey- ahk2exe

share|improve this answer
Actually, compiling them is unnecessary. I already defined them as functions. My question regarded specifically to the key up/down syntax. I wasn't finding it in the manual, so I asked here. Eventually I found a couple examples online, and it's exactly what you said except there's a blank space between "pause" and "up/down". – Malabarba Nov 9 '10 at 11:12
No need to add Down since its the default trigger. Only Up must be specified – nixda Sep 23 '14 at 18:37

You can accomplish the desired functionality with this code:

    keyWait, pause

If you are dealing with subroutines instead, use this:

    gosub, sub1
    keyWait, pause
    gosub, sub2
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.