Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get text of webpage
#5
Using regular expression.

Next QM release also will have function HtmlParse that gets document object model of HTML.

Code:
Copy      Help
function $HTML [MSHTML.IHTMLDocument2&doc2] [MSHTML.IHTMLDocument3&doc3]

;Creates document object model of HTML.

;HTML - HTML.
;doc2, doc3 - variables that, after calling the function, can be used to get parsed HTML information. Can be omitted or 0.


;EXAMPLE
;str s
;IntGetFile "http://www.quickmacros.com" s ;;download a html file
;
;MSHTML.IHTMLDocument2 d; MSHTML.IHTMLDocument3 d3
;HtmlParse(s d d3)
;
;s=d.body.innerText
;ShowText "body text" s
;
;MSHTML.IHTMLElement el=d.links.item(6)
;s=el.getAttribute("href" 0)
;s.replacerx("^about:") ;;relative links have "about:" at the beginning
;ShowText "URL of 7-th link" s
;
;MSHTML.IHTMLElement eb=d3.getElementsByTagName("B").item(0)
;s=eb.innerText
;ShowText "text of first bold text" s



MSHTML.IHTMLDocument2 d._create(uuidof(MSHTML.HTMLDocument))
ARRAY(VARIANT) a.create(1)
a[0]=HTML
d.write(a)

if(&doc2) doc2=d
if(&doc3) doc3=+d


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)