BreCalmor Posted December 5, 2010 Share Posted December 5, 2010 (edited) I am trying to select a table by class name, so I am using _IETagnameGetCollection and parsing through the tables returned to get the classname ($oTable.className). I can get a list of the tables no problem, but when I try to run an if statement to select that table name, it doesn't work right. If $oTable.className = "TheList" Then I also tried: If $sText = "TheList" Then Either way, when I use a msgbox or consolewrite, the value of the classname or the $sText variable is 0, yet it runs the If part and not the Else part. What the heck... $oTables = _IETagnameGetCollection($oIE, "table") $index = 0 For $oTable in $oTables $sText = $oTable.className If $sText = "TheList" Then ;ConsoleWrite("[" & $sText & "]" & @CR) MsgBox(4096, "Stop", "[" & $sText & "]" & @CR) ConsoleWrite($index & ":- [" & $oTable.className & "]" & @CR) ;$oTable = _IETagnameGetCollection($oIE, "table", $index) $aTableData = _IETableWriteToArray ($oTable, True) _ArrayDisplay($aTableData) ExitLoop Else ConsoleWrite($index & ": [" & $oTable.className & "]" & @CR) $index += 1 EndIf Next ConsoleWrite($index & ":END [" & $oTable.className & "]" & @CR) Thoughts? What am I doing wrong??? Thanks !! Edited December 5, 2010 by BreCalmor Link to comment Share on other sites More sharing options...
DaleHohm Posted December 5, 2010 Share Posted December 5, 2010 If String($oTable.className) = "TheList" Then 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...
Zedna Posted December 5, 2010 Share Posted December 5, 2010 (edited) If String($oTable.className) = "TheList" ThenGood to know about that, thanks Dale!I use your IE UDF too and I use some not implemented (here _IETagNameGetCollectionByClassName) properties/functions too so this trick can be handy for me too. Edited December 5, 2010 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
BreCalmor Posted December 5, 2010 Author Share Posted December 5, 2010 If String($oTable.className) = "TheList" ThenOhLesson LearnedThanks !! Link to comment Share on other sites More sharing options...
DaleHohm Posted December 5, 2010 Share Posted December 5, 2010 For those who are not familiar with the issue, when $oTable.className finds no match, it returns an integer 0, the expression is then deemed by autoit to be a numeric comparison... any string on the right side evaluates as an integer 0 and 0 = 0 is true. Using the String function on the left forces a string comparison.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...
Thlitmi Posted December 5, 2010 Share Posted December 5, 2010 How did you add [solved] mark ? I can not find it. Link to comment Share on other sites More sharing options...
Zedna Posted December 5, 2010 Share Posted December 5, 2010 (edited) How did you add [solved] mark ? I can not find it. Edit first post in topic and change Title - add [solved] Edited December 5, 2010 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Thlitmi Posted December 5, 2010 Share Posted December 5, 2010 Edit first post in topic and change Title (add [solved]) heh :-D thats the first thing I tried to do, but I did not find it I will try again Link to comment Share on other sites More sharing options...
Thlitmi Posted December 5, 2010 Share Posted December 5, 2010 Edit first post in topic and change Title - add [solved] Yes.......... now I see that I am blind............... 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