Sign in to follow this  
Followers 0
gfunk999

IE read table

4 posts in this topic

Hi All happy holidays, :)

Could someone please tell me what am I doing wrong??? I've been a this for three days going on four. Basically i'm just trying to read House (from the html source code below) and pass it to a variable.

#include <IE.au3>

$s_URL = "C:\monthly.html"

$oIE = _IECreate($s_URL)


$Table = _IEGetObjByName($oIE, "Table Chart")
$home = _IETagNameGetCollection($Table, "TR", 1)

MsgBox(0, "t", $home.firstChild.firstChild.href)

HTML Source Code

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<meta content="text/html; charset=ISO-8859-1"

http-equiv="content-type">

<title>Monthly Chart</title>

</head>

<body>

<div style="text-align: center;">

<h1>Table Chart</h1>

 </div>

<div style="text-align: center;"><br>

</div>

<table

style="width: 720; text-align: left; margin-left: auto; margin-right: auto"

border="1" cellpadding="2" cellspacing="2" height="229">

<tbody>

<tr>

<th

style="vertical-align: top; white-space: nowrap; text-align: center;" width="221" height="19">

Monthly Dates<br>

</th>

<th

style="vertical-align: top; white-space: nowrap; text-align: center;" width="300" height="19">

Category</th>

<th

style="vertical-align: top; white-space: nowrap; text-align: center;" width="171" height="19">

Status</th>

</tr>

<tr>

<td style="vertical-align: top;" width="221" height="20">12/01/2007<br>

</td>

<td style="vertical-align: top;" width="300" height="20">House<br>

</td>

<td style="vertical-align: top;" width="171" height="20">Active<br>

</td>

</tr>

<tr>

<td style="vertical-align: top;" width="221" height="19">11/01/2007<br>

</td>

<td style="vertical-align: top;" width="300" height="19">Cars<br>

</td>

<td style="vertical-align: top;" width="171" height="19">n/a<br>

</td>

</tr>

<tr>

<td style="vertical-align: top;" width="221" height="19">10/01/2007</td>

<td style="vertical-align: top;" width="300" height="19">Insurance</td>

<td style="vertical-align: top;" width="171" height="19">n/a</td>

</tr>

<tr>

<td style="vertical-align: top;" width="221" height="20">09/01/2007<br>

</td>

<td style="vertical-align: top;" width="300" height="20">Food<br>

</td>

<td style="vertical-align: top;" width="171" height="20">Active<br>

</td>

</tr>

<tr>

<td style="vertical-align: top;" width="221" height="19">08/01/2007<br>

</td>

<td style="vertical-align: top;" width="300" height="19">Utilities<br>

</td>

<td style="vertical-align: top;" width="171" height="19">n/a<br>

</td>

</tr>

<tr>

<td style="vertical-align: top;" width="221" height="19">07/01/2007</td>

<td style="vertical-align: top;" width="300" height="19">Rec</td>

<td style="vertical-align: top;" width="171" height="19">n/a</td>

</tr>

</tbody>

</table>

<p><br>

</p>

</body>

</html>

Share this post


Link to post
Share on other sites



Well... if that's all you need to do, then make it simple:

#include <IE.au3>
#include <Array.au3>;Only to display the table
$s_URL = "C:\monthly.html"

$oIE = _IECreate($s_URL)

$oTable = _IETableGetCollection ($oIE,0)
$aTableData = _IETableWriteToArray ($oTable, True)
_ArrayDisplay($aTableData)

MsgBox(0,"",$aTableData[1][1])

Share this post


Link to post
Share on other sites

I would've never thought to use an array. Thanks Nahuel this works great.

Well... if that's all you need to do, then make it simple:

#include <IE.au3>
#include <Array.au3>;Only to display the table
$s_URL = "C:\monthly.html"

$oIE = _IECreate($s_URL)

$oTable = _IETableGetCollection ($oIE,0)
$aTableData = _IETableWriteToArray ($oTable, True)
_ArrayDisplay($aTableData)

MsgBox(0,"",$aTableData[1][1])

Share this post


Link to post
Share on other sites

You're welcome :)

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