to jump to a point on a webpage.
e.g.
https://autohotkey.com/docs/misc/RegEx- ... tm#Options
https://autohotkey.com/docs/Variables.htm#Operators
https://autohotkey.com/docs/Variables.htm#ternary
I wondered if anyone had any ideas that could improve the script below.
Basically I look for these things in the html:
href="#
id="
name="
For example on the Ask For Help forum, I would like
to be able to skip to 'Topics',
the best I can do so far is to skip to 'Announcements':
https://autohotkey.com/boards/viewforum ... rum-search
I couldn't find any really good reference material on fragment identifiers,
can you skip to a specific line number for example, are there other bits of html
that can define a fragment identifier.
Code: Select all
;WBGet:
;Basic Webpage Controls with JavaScript / COM - Tutorial - Tutorials - AutoHotkey Community
;https://autohotkey.com/board/topic/47052-basic-webpage-controls-with-javascript-com-tutorial/
q::
vNeedle1 = href="#
vNeedle2 = id="
vNeedle3 = name="
WinGet, hWnd, ID, ahk_class IEFrame
;oWB := JEE_WBGet("ahk_id " hWnd)
oWB := WBGet("ahk_id " hWnd)
vText := oWB.document.documentElement.innerHTML
oWB := ""
vOutput := ""
VarSetCapacity(vOutput, StrLen(vText)*2)
vText := StrReplace(vText, "`r`n", "`n")
vText := StrReplace(vText, ">", "`n>")
vText := StrReplace(vText, " ", "`n")
vText := StrReplace(vText, vNeedle1, "`n" vNeedle1)
vText := StrReplace(vText, "<" vNeedle2, "<`n" vNeedle2)
vText := StrReplace(vText, " " vNeedle2, " `n" vNeedle2)
vText := StrReplace(vText, "<" vNeedle3, "<`n" vNeedle3)
vText := StrReplace(vText, " " vNeedle3, " `n" vNeedle3)
vNeedleRegEx := "^(" vNeedle1 "|" vNeedle2 "|" vNeedle3 ")"
Loop, Parse, vText, `n
if RegExMatch(A_LoopField, vNeedleRegEx)
if !(A_LoopField = vNeedle1 """")
vOutput .= A_LoopField "`r`n"
Clipboard := vOutput
MsgBox % "done"
Return