Jump to content

Recommended Posts

Posted

Very slow _IETableWriteToArray

#include

#include



;no check errors



$sUrl = @ScriptDir & '\test.htm'

$oIE = _IECreate($sUrl)

$oTable = _IETableGetCollection($oIE, 3)

$aTable = _IETableWriteToArray($oTable, True)

_IEQuit($oIE)

$oExcel = _ExcelBookNew()

_ExcelWriteSheetFromArray($oExcel, $aTable, 1, 1, 0, 0)

_ExcelBookSaveAs($oExcel, @ScriptDir & '\Test.xls', 'xls', 0, 1)

_ExcelBookClose($oExcel)

Table 30 000 - 50 000 lines

What alternative?

Posted (edited)

Well, AutoIt loops are slow and this function use a lot of loops. The alternative it's to try access data directly from table object without put it into an array.

Edit: typo error

Edited by Andreik
Posted (edited)

yes ,it just very slow ,you can use StringRegExp Function to get cell,you can try the code .

$sText = _IEDocReadHTML($oIE)
$aTableData = StringRegExp($sText,'(?<=>)[^<v"]+(?=<)',3)
_ArrayDisplay($aTableData)
Edited by sleep365
Posted (edited)

#include <IE.au3>
#include <Array.au3>
$sUrl = @ScriptDir & '\table.htm'
$oIE = _IECreate($sUrl)
_IELoadWait($oIE)
$htmltxt = _IEBodyReadHTML ( $oIE )
MsgBox(0,'t0',$htmltxt)
$aTableData = StringRegExp($htmltxt,'(?<=>)[^<\v"]+(?=<)',3)
_ArrayDisplay($aTableData)

I use the code ,get the result.

Edited by sleep365

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
×
×
  • Create New...