Jump to content

Loop through IE Tables


Recommended Posts

OK, I have tried to figure out how to loop through the tables in an IE web page.

I have a webpage at work that has between 5 and 30 tables (tables inside tables inside tables.... you know). So, I need to know each one and then can figure out what to do with them.

I have done the code below, but it never gets activated. So, need some guidance to make this work better (or, really, work at all).

Thanks, E

@oIE = _IECreate("http://",1,1) ; I put in the full URL when needed.
$oTable = _IETableGetCollection($oIE)
$iNumTables = @extended ; this give me a number of total tables in page

for $count = 0 to $iNumTables - 1
    $oTable = _IETableGetCollection($oIE, $count) ; redundant, but .... 
    $aTableData = _IETableWriteToArray($oTable)
    _ArrayDisplay($aTableData, "Table #" & $count)
next
Edited by dickep
Link to comment
Share on other sites

Try it this way:

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

$oIE = _IECreate("http://someurl.com", 1, 1)
$colTables = _IETableGetCollection($oIE)
If @error Then Exit

$iIndex = 0
for $oTable In $colTables
    $aTableData = _IETableWriteToArray($oTable)
    _ArrayDisplay($aTableData, "Table #" & $iIndex)
    $iIndex += 1
next

:mellow:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...