Sign in to follow this  
Followers 0
BreCalmor

[Solved]Selection by Table Class Name

9 posts in this topic

#1 ·  Posted (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 by BreCalmor

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If String($oTable.className) = "TheList" Then

Good 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 by Zedna

Share this post


Link to post
Share on other sites

If String($oTable.className) = "TheList" Then

Oh

Lesson Learned

Thanks !!

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

How did you add [solved] mark ? I can not find it.

Share this post


Link to post
Share on other sites

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 :graduated: I will try again :(

Share this post


Link to post
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0