kylomas Posted January 25, 2010 Share Posted January 25, 2010 Hi Everyone, Am new here so patients, please... I am trying to enumerate all nodes of an object of type "HTMLFILE". I am trying to clone an existing vbscript that works but is very slow... The error ocurrs in the "in...next" loop where the in variable is not an object. I am attaching the messages from the error routine and the script source...ne help is appreciated Thanks, kylomas I cannot attach files for som readon so source follows: #include <IE.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declare Dim $hdoc,$node,$n,$o,$htmlstr = "<html><head></head><body></body><p>text1<p>text2</body></html>" dim $oMyError,$HexNumber Global $g_eventerror = 0 ; to be checked to know if com error occurs. Must be reset after handling. $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ; Install a custom error handler$hdoc = ObjCreate("htmlfile") $hdoc = objcreate("htmlfile") $hdoc.open $hdoc.write($htmlstr) ;$hdoc.close $node = $hdoc.getelementsbytagname("html") if isobj($node) Then ; error ocurrs on the next line...I origionally wrote this as a function but suspected that the error ; had to do with passing an object to a function...to test whether or not that is true I put the following inline ; The error being generated is: ; ; windescription = "variable is not of type 'object' ; ; I've tried the reference to $n.childnodes with and without parentheses for $n in $node.childnodes() $o = $o & $n.nodename & " " & $n.nodevalue & " " & $n.nodetype & @CRLF ;if $n.haschildnodes then tw($n) next ;Msgbox(0,"Node List","Nodes:" & @CRLF & @CRLF & tw($node)); Msgbox(0,"Node List","Nodes:" & @CRLF & @CRLF & $o); EndIf exit func tw($node) for $n in $node.childnodes() $o = $o & $n.nodename & " " & $n.nodevalue & " " & $n.nodetype & @CRLF if $n.haschildnodes() then tw($n) next return $o endfunc ; This is my custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _ "Number is : " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription & @crlf & _ "Description is : " & $oMyError.description & @crlf & _ "Scriptline is : " & $oMyError.scriptline & @crlf & _ "Helpfile is : " & $oMyError.helpfile & @crlf & _ "Help context is : " & $oMyError.helpcontext & @crlf & _ "Last DLL error is : " & $oMyError.lastdllerror & @crlf & _ "Source is : " & $oMyError.source) $g_eventerror = 1 ; something to check for when this function returns Endfunc Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
DaleHohm Posted January 25, 2010 Share Posted January 25, 2010 Please describe what trouble you are having specifically. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
kylomas Posted January 27, 2010 Author Share Posted January 27, 2010 Hi Dale, Thanks for the prompt reply...the problem that I am having is that I am expecting to iterate throught the nodes of an HTML type object ($node). When I reference this variable though, Windoze is tossing error "variable is not of type object". What is puzzling is that the "isobject" returns TRUE and then on the very next line trying to iterate the nodes collection it fails with the afore mentioned message... If I can supply an other supporting doc, please let me know... kylomas P.S. I suck at using these forums so please bear with me!!!! Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
DaleHohm Posted January 30, 2010 Share Posted January 30, 2010 $node is an object... it is $node.childnodes() that is not an object. Please check the object model for htmlfile Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
kylomas Posted February 2, 2010 Author Share Posted February 2, 2010 Thanks, Dale...am trying to find "clear" doc at MSDN and on GOOGLE...looked at all the links in your signature, very interesting !!! Tom Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now