- If this script doesn't work correctly on a particular website, you could check oWB.document.url or oWB.document.title, and use specific handling for that website.
- Here's an example of some specific handling for Google. (Although the script below did work on Google.)
Internet Explorer: Google: focus input field - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=59054
Code: Select all
;test websites:
;https://www.amazon.com/
;https://autohotkey.com/boards/viewforum.php?f=6
;https://www.bing.com/
;https://www.dailymotion.com/us
;https://duckduckgo.com/
;https://www.ebay.com/
;https://www.facebook.com/
;https://accounts.google.com/
;https://www.google.com/
;https://www.imdb.com/
;https://en.wikipedia.org/wiki/Main_Page
;https://en.wiktionary.org/wiki/Wiktionary:Main_Page
;https://www.wolframalpha.com/
;https://www.youtube.com/
;WBGet function - AutoHotkey Community
;https://autohotkey.com/boards/viewtopic.php?f=6&t=39869
q:: ;focus input field
;^#f:: ;focus input field
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
oElts := oWB.document.getElementsByTagName("input")
Loop, % oElts.length
{
oElt := oElts[A_Index-1]
if (oElt.type = "checkbox")
|| (oElt.type = "hidden")
|| (oElt.type = "submit")
|| (oElt.type = "number")
|| (oElt.type = "button")
|| (oElt.type = "radio")
continue
;oElt.focus()
oElt.select()
;MsgBox, % "type/outerHTML:`r`n`r`n" oElt.type "`r`n`r`n" oElt.outerHTML
break
}
oWB := oElts := oElt := ""
return
- [EDIT:] Fix:
Code: Select all
;before:
Loop, % oWB.document.getElementsByTagName("input").length
{
oElt := oWB.document.getElementsByTagName("input")[A_Index-1]
;after:
oElts := oWB.document.getElementsByTagName("input")
Loop, % oElts.length
{
oElt := oElts[A_Index-1]