Jump to content
Sign in to follow this  

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)
Edited by dickep

Share this post

Link to post
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


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

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.