Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Navigating HTM
Hello Gintaras (or other forum members): 
I feel I should be able to figure this one out on my own but......

I need to get an htm element from under the mouse curser but then get the html for prior index elements and search that text until I find a particular regex match.
The problem is that I don't know how to get the successive new htm elements by navigating indices.
For acc there is:

Navigate($navig [Acc&result])

But there doesn't seem to be something similar for Htm where I could put in +/- 1,2,3,4 etc to navigate adjacent elements.

I tried to use Acc functions with this webpage but for some reason the navigate functions don't work, even with all the usual flags (i.e. in web page, invisible/useless objects, etc).

Thanks for any ideas I am overlooking,

Member function Htm.NavigateIndex_
Select All      Help
function navig [Htm&result]

;Gets an element near this element in the collection of all elements in the document.
;Error if navig is too big and there is no element at the result index.

;navig - offset of the element index from the index of this element. For example, if -1, gets previous element in the collection.
;result - if used, receives the result. Else the result will be this variable.

MSHTML.IHTMLDocument2 d=el.document
MSHTML.IHTMLElementCollection c=d.all
int i=el.sourceIndex+navig
MSHTML.IHTMLElement t=c.item(i)
if(t=0) end ERR_BADARG
if(&result) result.el=t; else el=t

Macro Macro21
Select All      Help
int w=wait(3 WV win("Quick Macros Forum - Internet Explorer" "IEFrame"))
Htm e=htm("A" "QM Home" "" w "0" 4 0x21 3)

#sub Out
function Htm&e

out F"{e.Tag} ''{e.Text}''"

Forum Jump:

Users browsing this thread: 1 Guest(s)