BreCalmor 0 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 Share this post Link to post Share on other sites
DaleHohm 65 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, curlMSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object modelAutomate input type=file (Related)Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better?IE.au3 issues with Vista - WorkaroundsSciTe 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 Share this post Link to post Share on other sites
Zedna 279 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 Share this post Link to post Share on other sites
BreCalmor 0 Posted December 5, 2010 If String($oTable.className) = "TheList" ThenOhLesson LearnedThanks !! Share this post Link to post Share on other sites
DaleHohm 65 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, curlMSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object modelAutomate input type=file (Related)Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better?IE.au3 issues with Vista - WorkaroundsSciTe 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 Share this post Link to post Share on other sites
Thlitmi 0 Posted December 5, 2010 How did you add [solved] mark ? I can not find it. Share this post Link to post Share on other sites
Zedna 279 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 Share this post Link to post Share on other sites
Thlitmi 0 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 Share this post Link to post Share on other sites
Thlitmi 0 Posted December 5, 2010 Edit first post in topic and change Title - add [solved] Yes.......... now I see that I am blind............... Share this post Link to post Share on other sites