3

I have a bluetooth remote with a Browser_Home key, which I'm attempting to remap with AutoHotkey on my Windows 10 machine.

By default, pressing Browser_Home does one of two things:

  • If the window in focus is my default browser (Firefox in my case), the current tab switches to the new tab page.*
  • If the window in focus is anything else, a new browser window is opened and brought into focus, opened to the new tab page.*

* Presumably, my configured homepage would open had I configured it to anything else.

Now I attempt to remap the Browser_Home using AutoHotkey:

Browser_Home::
    MsgBox Browser home button pressed
Return

(Edit: This is the entirety of the script I'm running, and I made sure it's the only AHK script running.)

The effects are different, depending on whether I have a Firefox window in focus when I press Browser_Home :

  • If the window in focus is my default browser (Firefox in my case), the desired behavior occurs: The key press is intercepted and a message box pops up. No browser tabs are affected.
  • If the window in focus is anything other than a default browser window, the AHK script appears to have no effect: A new browser window is opened and brought into focus, opened to the new tab page. No message box pops up.

Note that the same behavior appears to occur if I switch MessageBox with TrayTip or Send.

Clearly the remap fails when a default browser window is not in focus! This is a huge percentage of my usage cases, and as such extremely undesirable. Is there any way to successfully remap the Browser_Home key all the time?

Note: I know for sure the key in question is Browser_Home from AutoHotKey's keypress history.

5
  • This sounds a lot like you've accidentally included the hotkey definition inside the scope of an #IfWinActive clause. Jan 23, 2017 at 19:42
  • @AaronHarris I understand the feeling, but this doesn't seem to be the case. The behavior described about persists when both (a) the lines above form the entire script; and (b) when this is the only script running. I would guess that this behavior is left over from something like a #IfWinActive in windows' processing of a Browser_Home keypress -- c.f. my description of the default keypress behavior, and how it depends on the window in focus.
    – jjc385
    Jan 23, 2017 at 19:55
  • Yeah, kind of figured that this was an "is the computer plugged in" shot in the dark, but better to check the stupid stuff first. I'm afraid I'm out of ideas now, though. Jan 23, 2017 at 20:52
  • Very well written post, thumbs up. (1) Does the keypress register in the keypress history when the MsgBox doesn't trigger? (2) Do you know if there is an intermediate process or program mapping the bluetooth device to the keyboard press? (or just using the built-in windows bluetooth driver?) (3) Have you tried forcing your script to run at an elevated privilege level to see if there is a privilege level mismatch somewhere? If the answer to #1 and #3 is no, try running elevated to check operation and/or keyhistory at admin.
    – JJohnston2
    Feb 4, 2017 at 6:15
  • Also, it never hurts to add #IfWinActive before your hotkey definition since you always want the definition scope to be global. This is a relatively good habit to possibly save yourself a headache here or there once you start adding in other hotkeys.
    – JJohnston2
    Feb 4, 2017 at 6:17

1 Answer 1

0

I don´t know what are you trying to do but in my case the Browser_Home button that open a new Browser window is in the ESC key position and didn´t work in that way so using Autohotkey with this script did the job.

Script:

#InputLevel 1
Browser_Home::Escape

#InputLevel 0
; This hotkey can be triggered by both Browser_Home and Escape:

~Escape::Escape

Hope it can help you in some way. Enjoy!!!

1
  • Thanks for returning to such an old question that clearly fell off my radar. When the focused window is my default browser, this works (as did my attempt above). Unfortunately, when the focused window is something else, both (a) escape is fired and (b) a new browser window opens. In the latter case it seems both ESC and Browser_Home are being sent to the OS.
    – jjc385
    Oct 28, 2018 at 16:42

You must log in to answer this question.

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