Jump to content

Help IETableWriteToArray


MaoMao
 Share

Recommended Posts

The _IECreate is very slow. Not sure why when open with IE for the url. But FireFox open very fast on the computer.

Tried alternative (InetRead, INetGetSource) but not working. No table is written to array.

Please help.

#include <IE.au3>
#include <Array.au3>
#include <Inet.au3>
Local $Url = 'http://www.bts.gov/publications/national_transportation_statistics/html/table_01_37.html'
;$oIE = _IECreate($Url, 0, 0) ; Ex1 slow
;$oIE = BinaryToString(InetRead($Url)) ; Ex2 not getting the table
$oIE = _INetGetSource($Url, 'True') ; Ex3 not getting the table
    ConsoleWrite($oIE)
    MsgBox(0, "oIE Info", $oIE)

$oTable = _IETableGetCollection ($oIE) ; Get number of tables
$iNumTables = @extended
MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page")

$oTable = _IETableGetCollection ($oIE, 0) ; Get  table
$aTableData = _IETableWriteToArray ($oTable)
_ArrayDisplay($aTableData)

$oTable = _IETableGetCollection ($oIE, 1) ; Get next table
$aTableData = _IETableWriteToArray ($oTable)
_ArrayDisplay($aTableData)
Edited by MaoMao
Link to comment
Share on other sites

  • Moderators

Hi, MaoMao. Let's start line by line. You state that IECreate is very slow, but it opened for me immediately. I noticed, however, you have visible set to 0 in your IECreate statement. Is this by design?

;$oIE = _IECreate($Url, 0, 0) ; Ex1 slow

This part works for me, and returns in less than a second.

#include <IE.au3>
#include <Array.au3>
#include <Inet.au3>
Local $Url = 'http://www.bts.gov/publications/national_transportation_statistics/html/table_01_37.html'
$oIE = _IECreate($Url, 0, 1, 1) ; Ex1 slow
$oTable = _IETableGetCollection ($oIE) ; Get number of tables
$iNumTables = @extended
MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page")
$oTable = _IETableGetCollection ($oIE, 0) ; Get  table
$aTableData = _IETableWriteToArray ($oTable)
_ArrayDisplay($aTableData)

The next part does not work, but that is because you only have one table on the page (as your Msgbox tells you).

$oTable = _IETableGetCollection ($oIE, 1) ; Get next table
$aTableData = _IETableWriteToArray ($oTable)
_ArrayDisplay($aTableData)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hi JLogan3o13, Thanks for the help.

IE visible is for debug only. Not helping the performance when set to invisible.

The site is one testing example. There are other sites with over 1000 record slows down the IECreate performance. (>30 seconds)

For repeating loop. It is not acceptable.

I'm not sure why Other large table sites opened much faster in FireFox i.e. 12 seconds in the same computer.

The InetRead($Url)) and _INetGetSource($Url) is fast to load the html content but not getting the table to Array.

Need advice for using the InetRead and INetGetSource html content file load to array for processing.

Trying load html to Excel for processing but this alternative got other problem.

Edited by MaoMao
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...