AutoHotkey: Using Firefox/Chrome Browser Hotkeys While Flash Has Focus

If you know what you’re doing and don’t need my rambling, you can get what you want from here.

If not: I (and countless others) have spoken at length about AutoHotkey and why you should be using it. For the uninitiated, it is an extremely powerful and easy-to-learn scripting language that you can use to fix just about any problem you throw at it. You can use it to automate all your repetitive, boring tasks and even create entirely new workflows. Case in point: this article.

Either by bug or design, there has been a shortcoming in Firefox and Chrome for years now that allows Flash to steal focus from their containers and prevent any browser-specific hotkeys from accomplishing their tasks. That is, trying to hit Ctrl+W to close a YouTube tab after having clicked anywhere in the YouTube window will serve no purpose. Maybe you’re watching something you probably shouldn’t, when you probably shouldn’t, and your boss catches you because your hotkeys weren’t working. Oh the humanity.

The attached scripts are simple workarounds, but effective. AutoHotkey’s keyboard hook supersedes even that of Flash, so it can interpret hotkeys even when Flash has focus. These little programs simply receive the hotkeys, shift focus away from Flash, and send the hotkeys where you wanted them to go in the first place.

You can install AutoHotkey from here. Then it’s simply a matter of saving either the Firefox or Chrome version (or both, I guess) from the GitHub link at the start of this post and double-clicking it. Let me know if you need any more help, if this worked for you, or especially if it didn’t. Happy __tubing.

2 thoughts on “AutoHotkey: Using Firefox/Chrome Browser Hotkeys While Flash Has Focus

  1. Elias

    Vince, your github link doesnt work. Do you still have those AHK scripts? This problem with Flash stealing keyboard focus is driving me crazy and I havent found any solution yet.

    Reply
    1. Vince Post author

      Ah. It does not look like I do — sorry. Not entirely sure why it disappeared. (Un)Fortunately, this behavior doesn’t seem to exist in Win10, so I can’t even reproduce the problem on my end to confirm whether or not a new script would work. IIRC, the scripts were super simple, and looked something like what I have below. Added some comments in case you’re not at all familiar with AHK.

      SetTitleMatchMode, Regex
      #If WinActive(“Chrome”) ; You could be more specific and say “YouTube” as well
      $^w:: ; Don’t forget the $. It’s important.
      winActivate, ahk_class Progman ; Activate desktop
      winActivate, Chrome ; or whatever browser
      send ^w
      return
      #if

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *