Code: Select all
;[WBGet function]
;Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials - AutoHotkey Community
;https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/
#IfWinActive, AutoHotkey Community - Post a reply ahk_class IEFrame
;autohotkey forum - apply 'F3' to message, find text
^f::
^#f::
^j::
^#j::
F3::
F4::
^F4::
WinGet, hWnd, ID, A
oWB := WBGet("ahk_id " hWnd)
;vUrl := oWB.document.url
;vTitle := oWB.document.title
oElt := oWB.document.getElementById("message")
vPos1 := oElt.selectionStart
vPos2 := oElt.selectionEnd
vText := oElt.innerText
vText := StrReplace(vText, "`r`n", "`n")
if InStr(A_ThisHotkey, "^") || (vNeedleAHkForum = "")
;JEE_InputBoxVPD(vNeedleAhkForum, "Find what:", vNeedleAhkForum)
InputBox, vNeedleAhkForum,, % "Find what:",,,,,,,, % vNeedleAhkForum
if (vPos := InStr(vText, vNeedleAhkForum, 0, vPos1+2))
{
oElt.selectionStart := vPos-1
oElt.selectionEnd := vPos-1+StrLen(vNeedleAhkForum)
oWB.document.selection.createRange().scrollIntoView()
}
else
MsgBox % "Cannot find """ vNeedleAhkForum """"
oWB := oElt := ""
return
#IfWinActive