Jump to content

IE Table Get Collection


jfcby
 Share

Recommended Posts

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 ****

Link to comment
Share on other sites

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

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...