Jump to content
Sign in to follow this  
jfcby

IE Table Get Collection

Recommended Posts

jfcby

I have a HTML table that I need to automatically get the number of rows and columns and get the value of each cell while looping through the table?

An example would be row one would have two columns of data.

I've tried the following code from the help file but it list all data in the table.

#include <IE.au3>
#include <Array.au3>

;Local $oIE = _IE_Example("table")
Local $oIE = _IEAttach("Shop")
Local $oTable = _IETableGetCollection($oIE, 14)
Local $aTableData = _IETableWriteToArray($oTable, True)
_ArrayDisplay($aTableData)

I tried to modified it using the following code to display row one column one cell data and row one column two cell data to loop through the table but I'm getting a syntax error.

#include <IE.au3>
#include <Array.au3>

Local $oIE = _IEAttach("Shop")
$oTable = _IETableGetCollection($oIE, 14)
Local $aTableData = _IETableWriteToArray($oTable, True)

For $i = 0 To UBound($aTableData) - 1
    MsgBox(1,1, $aTableData) ; & " - " & $aTableData[1]) ;<< get syntax error here
Next

I've read through and tried some scripts in the forum but none have worked.

Thank you for your help,

Frankie Cooper


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post


Link to post
Share on other sites
Chimp

once you got the table, you have to use data directly from the array.
try this:

#include <IE.au3>
#include <Array.au3>

Local $oIE = _IEAttach("Shop")
$oTable = _IETableGetCollection($oIE, 14)
Local $aTableData = _IETableWriteToArray($oTable, True)

MsgBox(0, "row one column one", $aTableData[1][1])
MsgBox(0, "row one column two", $aTableData[1][2])

For $i = 0 To UBound($aTableData) - 1
    MsgBox(0, "", $aTableData[$i][1] & " - " & $aTableData[$i][2])
;   ConsoleWrite($aTableData[$i][1] & " - " & $aTableData[$i][2] & @CRLF) ; <-- this is better
Next

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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  

×