How can I use Autohotkey to focus on an existing Google Chrome tab, not a "container" window?
Google Chrome seems to represent each window with a container window handle, which contains one or more tabs. The tabs (at least the current one), has its own window handle. The tab window handles have window titles (which currently all end in " - Google Chrome"), whereas the container window handle itself does not. The following autohotkey code does not work as intended for Google Chrome:
^+i:: if WinExist("ahk_class Chrome_WidgetWin_0") WinActivate else Run "C:\Users\vleeshue\AppData\Local\Google\Chrome\Application\chrome.exe" return
This binding will focus on a Google Chrome window if it exists or will run Google Chrome. However, it will often target the container window (in Window Spy, the window title is blank). Activating the container window disallows the use of Google Chrome keyboard shortcuts. The inaccessible keyboard shortcuts include the all important ctrl+l to access the omnibar. Since I have not yet found a way to consistently activate the tab window instead of the container window, my workaround is to use the mouse, but I'd prefer to avoid that if possible.
Window Spy Screenshots
Current Google Chrome Version: 5.0.317.2 dev
A common autohotkey binding I use is a keyboard shortcut to focus a specific application if it's already running or to run the application if it isn't running.
For example, I use this for foobar2000
^+m:: If WinExist("foobar2000") WinActivate else Run "C:\Program Files (x86)\foobar2000\foobar2000.exe" return