Sign in to follow this  
Followers 0
AlexVong

_IETableWriteToArray - medley works

5 posts in this topic

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?

Share this post


Link to post
Share on other sites



#2 ·  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

When the words fail... music speaks

Share this post


Link to post
Share on other sites

#3 ·  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

Share this post


Link to post
Share on other sites

#5 ·  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

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