6

I have a fairly simple autohotkey script that starts and stops music playback when I press one of the XButtons on my mouse: XButton1::Send {Media_Play_Pause}. The program works just perfectly and I have no problems with it. However, when I'm using Notepad++, it intercepts the mouse button hotkey before AutoHotKey does and switches tabs. This forces me to switch away from Notepad++ when I want to use this hotkey.

Is there any way I can change the order in which programs intercept hotkeys so that AutoHotKey always gets first dibs on any entered keystrokes or mouse buttons?

Or, is there a setting I can change in Notepadd++ to turn off the XButton functionality. I looked through all the settings, but I couldn't find anyway to stop this.

vividn
  • 121
  • 5

3 Answers3

6

Okay. I think I managed to figure it out. The problem was that I was running Notepad++ as an administrator, so I guess it got higher precedence in the hotkey selection. Running AHK as an admin as well solved the problem.

vividn
  • 121
  • 5
0

In notepad++, you can go to settings > shortcut mapper...

If your X buttons are simulating keystrokes you might have to remove the equivalent keyboard shortcut.

Helio Santos
  • 6,606
  • 3
  • 25
  • 31
  • I've looked through there as well. It appears to only have the keyboard hotkeys, not the tab-switching mouse hotkeys. – vividn Feb 14 '14 at 00:49
  • The problem occurs when literally the entire ahk script is: `XButton1::Send {Media_Play_Pause}`. There is no keyboard shortcut in Notepad++ for Media_Play_Pause. Notepad++ also documents that it implements this tab switching behavior for the XButtons (unfortunately, not how to get rid of it however). I'm pretty sure that Notepad++ is just intercepting the hotkeys before AutoHotKey. – vividn Feb 14 '14 at 01:15
0

I had a similar problem with RDP windows.

Whenever the RDP window was active, it would intercept all key presses and my script would get nothing.

I solved this problem by having the script check every 10 seconds if the active window is an RDP window and if it is, the script reloads.

If you have variables that you need to keep, you can store them in an INI file or as global variables (either solution will slow your script down a bit).

This is not a perfect solution, because your hot-keys will not respond right away if you just opened Notepad++.

Michael
  • 1,263
  • 1
  • 12
  • 28