jezzzzy Posted June 21, 2006 Share Posted June 21, 2006 (edited) Can't seem to read text associated with a tag or id. Trying to simply read the contents of a tag or and id to a variable. Not sure what I'm missing. I've gone through the IE help. I have a feeling I'm about to feel dumb. Code looks like this: $wObjIE = _IECreate($wURL) $wTitle = _IETagNameGetCollection($wObjIE,"h3") MsgBox(0,"Title",$wTitle.name) _IEQuit($wObjIE) oÝ÷ Ø l¢ÚâyÛaÆ®¶s` b33c·tö&¤RÒôT7&VFRb33c·uU$ b33c·uFFÆRÒôTvWDö&¤'æÖRb33c·tö&¤RÂgV÷C¶7FÃô6öçFVçEÆ6TöÆFW%õFFÆTVFW"gV÷C² ×6t&÷ÂgV÷CµFFÆRgV÷C²Âb33c·uFFÆRææÖR ôUVBb33c·tö&¤R Partial source of the page I am trying to read is this: <div id="productBox" class="purchaseContainer"> <div id="ctl00_ContentPlaceHolder_SaleTagPanel" class="saleTag"> <h3 id="ctl00_ContentPlaceHolder_TitleHeader">Page Item Title</h3> All I need is for $wTitle to equal "Page Item Title". I need to be able to "read" what is contained in the object. Edit: I have thought about reading the source into a variable, but then I would need to strip out the text between the tags and somehow only pull the Nth tag, etc. Edited June 21, 2006 by jezzzzy Link to comment Share on other sites More sharing options...
DaleHohm Posted June 21, 2006 Share Posted June 21, 2006 Can't seem to read text associated with a tag or id. Trying to simply read the contents of a tag or and id to a variable. Not sure what I'm missing. I've gone through the IE help. I have a feeling I'm about to feel dumb. Code looks like this: $wObjIE = _IECreate($wURL) $wTitle = _IETagNameGetCollection($wObjIE,"h3") MsgBox(0,"Title",$wTitle.name) _IEQuit($wObjIE) oÝ÷ Ø l¢ÚâyÛaÆ®¶s` b33c·tö&¤RÒôT7&VFRb33c·uU$ b33c·uFFÆRÒôTvWDö&¤'æÖRb33c·tö&¤RÂgV÷C¶7FÃô6öçFVçEÆ6TöÆFW%õFFÆTVFW"gV÷C² ×6t&÷ÂgV÷CµFFÆRgV÷C²Âb33c·uFFÆRææÖR ôUVBb33c·tö&¤R The first example returns a collection, so you need to specify which instance you want... _IETagNameGetCollection($wObjIE,"h3", 0). In both cases you don't want .name, but rather .innerText Dale Partial source of the page I am trying to read is this: <div id="productBox" class="purchaseContainer"> <div id="ctl00_ContentPlaceHolder_SaleTagPanel" class="saleTag"> <h3 id="ctl00_ContentPlaceHolder_TitleHeader">Page Item Title</h3> All I need is for $wTitle to equal "Page Item Title". I need to be able to "read" what is contained in the object. Edit: I have thought about reading the source into a variable, but then I would need to strip out the text between the tags and somehow only pull the Nth tag, etc. 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...
Moderators big_daddy Posted June 21, 2006 Moderators Share Posted June 21, 2006 Try this: #include <IE.au3> _IEErrorHandlerRegister () $sUrl = "your url here" $oIE = _IECreate($sURL) $oTags = _IETagNameGetCollection($oIE, "h3") For $oTag In $oTags If $oTag.Id == "ctl00_ContentPlaceHolder_TitleHeader" Then $sTitle = $oTag.innerText ExitLoop EndIf Next MsgBox(0, "Title", $sTitle) Link to comment Share on other sites More sharing options...
jezzzzy Posted June 21, 2006 Author Share Posted June 21, 2006 Thank you guys. Was missing .innerText. Where is that information listed so I don't have to bother you with stupid questions in the future? Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 21, 2006 Moderators Share Posted June 21, 2006 Thank you guys. Was missing .innerText.Where is that information listed so I don't have to bother you with stupid questions in the future?No problem, MSDN is a great reference. 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