How to focus WEB-browser with a hotkey in Windows?

1

In Windows desktop shortcut's properties one can assign a Hot Key to launch that shortcut. There are

Three Possible Outcomes

  1. First time the hot-key launches that application, next time it brings the already-open window to the front and focuses it. This is the preferred behavior (by me). Good applications with this behavior are: Far Commander, Putty, AIMP, Scite, Emacs and most other.
  2. The hot-key launches a new instance of the application every time. This is worse than useless (for my style of working). Includes all Java applications, Internet Explorer and some other.
  3. The hot-key does not launch a new instance of the application, but does not bring the existing one to the top either (the first time it launches the application and then it is on the top). Keyboard focus is taken away from the current application but not given to any other application. Also pretty useless. Example: Opera browser, there are others.

This is the same in all versions of WindowsNT, 5.0 and upwards (don't know about 3.5-4.0).

I want to switch to an already-open browser with a hot-key, e.g.

  • CTRL+ALT+F -> FireFox,
  • CTRL+ALT+O -> Opera,
  • CTRL+ALT+C -> Chromium,
  • CTRL+ALT+I -> Internet Explorer,

but none of them function that way with the Windows shortcut hot-keys. Is there another solution? The window titles are all unpredictable. Is there another browser that supports hot-keys?

MKaama

Posted 2014-05-15T15:58:58.263

Reputation: 301

Urm, downvoting the only answer was probably not the best way to encourage people to help. I'm removing the answer as I'd prefer not to loose points. For reference, the answer stated that AutoHotKey (which you now say you've used for years) will do exactly what you want. – Julian Knight – 2014-05-19T13:07:01.907

1@JulianKnight From the few sentences it was difficult to judge your personality. My impression was that you are cheapskating for points. Too little effort. To make the site better I wanted to see the actual script, because it is non-trivial and has a couple of snags. This is a non-programming site. Even if You are a programmer, other users might not be. Also, I wanted to hear some condolence that the shortcut paradigm is indeed limited and the browser writers have all conspired to do a poor job. – MKaama – 2014-05-20T06:05:48.333

In fact I was trying to give you a steer in the short time I had. It isn't difficult to do a Google search to find possible solutions directions for this question and it appeared that you hadn't bothered to do that. Indeed, as you then asserted that you already used AHK, the answer was already on your PC. It may be a non-prog site but it is for "super users" & a reasonable amount of up-front effort is encouraged (often vocally). AHK is not a programmers tool & I would certainly have helped further when time allowed had I not been immediately voted down. Anyway, glad I steered you to an ans. – Julian Knight – 2014-05-22T08:33:08.153

Answers

1

If you are using Windows 7 or above, Start#, where # is any digit, will switch to an existing instance of the #-th program from left if it is not already launched.

kinokijuf

Posted 2014-05-15T15:58:58.263

Reputation: 7 734

Unfortunately, the numbers change all the time, so it is not very helpful. BTW, this is the first time I see the Windows key called "Start" :-) – MKaama – 2014-05-20T06:29:55.090

1If you pin them, they will not change – kinokijuf – 2014-05-20T06:31:04.650

0

OK, I did investigate AutoHotkey, and here is the script.

;This will bring up existing Internet Explorer with CTRL+ALT+I
#IfWinNotExist ahk_class IEFrame
^!i::
run IEXPLORE.EXE
return
#IfWinNotExist
#IfWinExist ahk_class IEFrame
^!i::
WinActivate ahk_class IEFrame
return
#IfWinExist

For Firefox and Opera the classes are respectively

ahk_class MozillaWindowClass
ahk_class OpWindow

I no longer use Chromium.

MKaama

Posted 2014-05-15T15:58:58.263

Reputation: 301

Shame you felt the need to downvote my answer then! – Julian Knight – 2014-06-30T08:09:37.237