I'm trying to figure out if it's possible.

While I hold mouse-button 4 ( back ) down, it should execute pressing down the combination ctrl+g every 50 ms.

I can do it with my Logitech mouse, but I need to do it with a no name mouse. I dunno if AutoHotkey allows it.

Anybody got an idea?

  • To determine the designation for an unknown button/key. Double click on the AHK icon. Press ctrl-K in the window to open the key history. Press the button in question. Press F5. You'll get something like this 04 000 d 5.37 MButton 04 000 u 0.17 MButton 74 03F d 0.86 F5 This shows the Middle Mouse Button going down, up, then F5 down. – EFH Mar 21 '16 at 19:40

This should work:

    while (GetKeyState("XButton1", "P")) {
        SendInput, ^g
        Sleep, 50
| improve this answer | |
  • So it works! That's friggin awesome. Is it possible to make the script only execute in a specific application? Like, say if I have Notepad++ up, then the mouse button script should ONLY work in Notepad++ nowhere else. Or a game or anything. – Grumpy ol' Bear May 18 '15 at 17:44
  • Oh, I also noticed this ONLY works with pressing the XButton1, but if I for example have shift+XButton1 pressed, it doesn't work. – Grumpy ol' Bear May 18 '15 at 17:49
  • @DonSalva Check out the #If directive and the hotkey docs, it should have some info about how to use modifiers. – Sidola May 18 '15 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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