topsyleeus Posted March 15, 2012 Posted March 15, 2012 (edited) Hi, I have a HTML fime like this - </SCRIPT> <TABLE class=report width=100%> <TR><TD> </TD></TR> <TR><TD> <span style="font-family:Arial"> <TABLE class=report border="0" width="100%"> <tr> <td width="50%"><H1 class=report>Change Summary</H1></td> <td><p align="right"><b>As Of: </b> 03/14/2012 2:35:52 am </td> </tr> </TABLE> <p> <p> <TABLE class=report border="0" width="100%" cellpadding="0"> <tr> <td width="10%"><b>Change#</b></td> <td width="25%"><b>Status / Category</b></td> <td width="25%"><b>Open Date</b></td> <td width="30%"><b>Affected Contact</b></td> <td width="10%"><b>Priority</b></td> </tr> </TABLE> <TABLE class=report border="0" width="100%" cellpadding="0"> <tr> <td width="10%" valign="top">40296 </td> <td width="25%" valign="top">Completed </td> <td width="25%" valign="top">2/02/2012 9:17:13 am </td> <td width="30%" valign="top"> </td> <td width="10%" valign="top">3 - Med </td> </tr> <tr> <td width="10%"></td> <td width="25%" valign="top"> </td> <td colspan="3"><b>Summary: </b> </td> </tr> </TABLE> <hr> <TABLE class=report border="0" width="100%" cellpadding="0"> <tr> <td width="10%" valign="top">40238 </td> <td width="25%" valign="top">Completed </td> <td width="25%" valign="top">1/30/2012 12:02:15 pm </td> <td width="30%" valign="top"> </td> <td width="10%" valign="top">3 - Med </td> </tr> <tr> <td width="10%"></td> <td width="25%" valign="top"> </td> <td colspan="3"><b>Summary: </b> </td> </tr> </TABLE> <hr> <TABLE class=report border="0" width="100%" cellpadding="0"> <tr> <td width="10%" valign="top">40226 </td> <td width="25%" valign="top">Completed </td> <td width="25%" valign="top">1/27/2012 2:53:26 pm </td> <td width="30%" valign="top"> </td> <td width="10%" valign="top">3 - Med </td> ....and so on I want to read the 1st column's five digit numbers for every table. Like the file should contain data like - 40296 40238 40226 ............ How do I achieve that? Edited March 26, 2012 by topsyleeus
UEZ Posted March 15, 2012 Posted March 15, 2012 Try this: #include <Array.au3> $sHTML = FileRead(@ScriptDir & "Test.html") $aChangeNo = StringRegExp($sHTML, 'valign="top">(d+).rn', 3) _ArrayDisplay($aChangeNo) Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
James Posted March 15, 2012 Posted March 15, 2012 (edited) Have a look at the IE.au3 UDF. There are some perfect help file examples that will get you started. It's listed under _IE* in the help file index Edit: Wrong function. Edited March 15, 2012 by JamesBrooks Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
topsyleeus Posted March 26, 2012 Author Posted March 26, 2012 (edited) Thank you both..Here goes the working code #include <IE.au3> #include <Array.au3> Local $oIE =_IEAttach("Title of the page") Local $oFrames = _IEFrameGetCollection($oIE) Local $iNumFrames = @extended Local $oFrame = _IEFrameGetCollection($oIE, $iNumFrames-1) MsgBox(0, "Frame Info", _IEPropertyGet($oFrame, "locationurl")) local $reportFrame = _IEBodyReadHTML($oFrame) MsgBox(0, "Frame Info", $reportFrame) $oTable = _IETableGetCollection($oFrame) Local $iNumTables = @extended MsgBox(0, "test", $iNumTables) for $i = 4 To $iNumTables-1 Local $oTables = _IETableGetCollection($oFrame,$i) Local $aTableData = _IETableWriteToArray($oTables,True) $coNumbers = $aTableData[0][0] MsgBox(0, "Test", $coNumbers) Next Edited March 26, 2012 by topsyleeus
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now