windows 7 - Google Chrome has taken over all HTML handling...
2013-12
It's really getting on my nerves, but Google Chrome has taken over all HTML handling.
For example, when you open Spotify... it runs C:/Users//AppData/Local/Spotify/flashdetect.html, but now that page is acctually opened in chrome as a new window.
This also is the case for my Asus GamerOSD application that is located in tray. If I try to open settings Chrome takes over and opens C:/Program%20Files%20(x86)/ASUS/GamerOSD/Skin/GamerOSD.html instead of the application doing it... :(
Anyone know this problem and how to fix it?
Check the .htm and .html classes in the registry. Chrome has a habit of changing these to ChromeHTML
Open Regedit
Find the key HKEY_CLASSES_ROOT\.html
Right click the (Default) value for the .html key and select Modify...
Change the value from "ChromeHTML" to "htmlfile"
Do this for .htm as well.
You don't say what web browser you want to be the default, but you can do this from within that browser.
If you have set the "check for default browser" option in your preferred browser then the next time you open it it should ask you if you want to set it to be the default again. Say "yes" and you're good to go.
If you haven't enabled that option then you'll need to manually make it the default again:
For IE8
- Open the browser.
- Select Tools > Internet Options... then the Programs tab.
- In the "Default web browser" section click on the "Make Default" button.
IE is now your default browser.
For Firefox
- Open the browser
- Select Tools > Options... then the Advanced panel and General tab.
- Click on the "Check Now" button in the bottom left of the dialog.
Firefox is now your default browser.
Other browsers have similar options
How can I use Autohotkey to focus on an existing Google Chrome tab, not a "container" window?
Details
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
Background
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
^+i::
if WinExist("ahk_class Chrome_WindowImpl_0")
{
WinActivate
ControlFocus, Chrome_AutocompleteEditView1
}
else
Run "C:\Users\vleeshue\AppData\Local\Google\Chrome\Application\chrome.exe"
return
Should do the trick
("Chrome_AutocompleteEditView1" is the name of the omnibar control, so you could add Send ^a
to select all)
Update: I can't reproduce, maybe it will be better with another control... To have a list of a window controls I use this code:
#Persistent
SetTimer, WatchCursor, 100
return
WatchCursor:
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
WinGet, ControlList, ControlList, A
ToolTip, Under Cursor:`nahk_id: %id%`nahk_class: %class%`nTitle:%title%`nControl: %control%`n`nWindow Control List:`n%ControlList%
return
So the controls of my google chrome 4.0.249.78 beta (36714) are:
- ViewsTextfieldEdit1
- Chrome_RenderWidgetHostWND1
- Chrome_AutocompleteEditView1
- Chrome_WindowImpl_01
- Chrome_WindowImpl_02
Workaround using Alt+Tab:
; Activates the window identified with wintitle if it's active,
; else opens a new one
OpenWindow(wintitle, runCommand)
{
if WinExist(wintitle)
WinActivate ; activates the window found above. Sweet.
else
Run %runCommand%
}
#g::
AppsKey & g::
prevKeyDelay := A_KeyDelay
SetKeyDelay, 100
OpenWindow("ahk_class Chrome_WidgetWin_0", A_AppData
. "\Local\Google\Chrome\Application\chrome.exe")
SendEvent {Alt down}{Tab}
SendEvent +{Tab}
SendEvent {Alt up}
SetKeyDelay, prevKeyDelay
return
Adjust arguments as needed. SetKeyDelay used because sending too fast does not work.
You may want to look at using a Chrome extension instead of AutoHotkey. Extensions can get access to all the open tabs, including the URL and the ability to change tab focus. Otherwise you probably would need to use the Accessibility features in Chrome to query the active window. I believe that is how programs like RescueTime track what the active URL is. For example, using the Accessible Event Watcher (AccEvent) from the Windows 7 SDK shows the following events when changing tabs in Chrome:
Window Spy returns the tab title in the "Visible Window Text" field.
You could loop in the tabs until you find the desired text. To switch from tab to tab, send the CTRL+TAB keys. The problem would be to stop at some point but if you know you don't use more than X tabs at most, you can include a counter in the loop to break at some point if the desired tab is not found.
There seems to be a bug with the WinActivate function in AutoHotkey. (http://productivegeek.com/forums/topic/autohotkey-problem-restoring-minimized-window-and-giving-keyboard-focus)
So instead of the WinActivate line, use
WinGet, winid, ID,
DllCall("SwitchToThisWindow", "UInt", winid, "UInt", 1)
!f::
IfWinExist ahk_class Chrome_WidgetWin_0
{ IfWinActive ahk_class Chrome_WidgetWin_0
{ Loop, 60
{ GetKeyState, state, C
if state = D
{ KeyWait, c
KeyWait, LAlt
Sleep 10
;must send RCtrl!!!
Send {RCtrl down}
Send {w down}
Sleep 10
Send {w up}
Send {RCtrl up}
break
}
Sleep 1
}
}
else
{ KeyWait,f
KeyWait,LAlt
;don't hijack other apps
Send f
}
}
return