Jump to content

Need help with _IETableGetCollection


MaoMao
 Share

Recommended Posts

Trying to find faster way to write a web page table to Array.

The _IETableGetCollection ($oIE, 0) is not getting any Table data with InetRead($Url) and _INetGetSource($Url, 'True') Help please?

Sample code:

$oIE = InetRead($Url) ; not getting the table

;$oIE = _IECreate($Url) ; slow

;$oIE = _INetGetSource($Url, 'True') ; not working

;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 last table

$aTableData = _IETableWriteToArray ($oTable)

_ArrayDisplay($aTableData)

Edited by MaoMao
Link to comment
Share on other sites

  • Moderators

MaoMao, this is like the third post you have just today for the same thing, not to mention the one that started it all from two days ago. You make it difficult to assist you with all the different threads.

"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

Plus you have no clue what you are doing. Stop and read the documentation and run the examples.

_IETableGetCollection takes an IE OBJECT as it's first parameter - the object returned by _IECreate or _IEAttach. In your code, you are trying to pass it a string with HTML in it. Pay attention to the error messages that you get when you run your code, they are not NOISE! They will tell you that what you passed in the first parameter is invalid.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

P.S. Checking in progress:

Thank for the help in the mean time. New to this. Pardon me for the patient.

;Working on statistic on web format info most of them in table style

(or partially tabled but the layout may not be propertly written to display smoothly and quick).

Testing different ways to try solve the problem quickly.

(Use Post1 for Array or Post2 for Excel solution question. Both got difficulities)

_IECreate($Url) ; working with Array but slow.

Page and usable table content was displayed then it seems loading something in background for another >30Sec.

_IECreate($Url,0,0,1); not waiting cause _IECreate program breaking error.

Something may missing if not waiting for all the info passing back. Use another X86 old PC(New WinXP n IE) took >3 minutes to load whole page. Same old PC use Chrome/Firefox took <10 seconds only.

Thanks Dale. It seems _IETableGetCollection works with _IE function only.

Now looking for more info to understand this.

Searching if there are other faster way pass the page info to _IETableWriteToArray ($oTable).

If not successful for Array. That will force back to use Excel for analysis process.

Are there Chrome/FireFox function by the way?

Edited by MaoMao
Link to comment
Share on other sites

If there is something causing a delay in final page load, it will happen when you do it manually as well. It may be taking as long to do the final load in Firefox and Chrome as well, but you may not notice since it may not inhibit your ability to interact with the page. If this is not the case, you may have an add-on loaded in IE that is causing you trouble... to test this, use Accessories, System Tools, Internet Explorer (no add-ons) for comparison.

You can also load the page with _IECreate and NoWait parameter and then check on the page yourself to see if the element is ready for you, See _IEPropertyGet "readystate" to check the ReadyState of the borowser (document) and it will likly need to be 3 or "interactive" in order to proceed. You can also use _IETableGetCollection or _IEGetObjByName or _IEDocReadHTML to check to see if your table is ready yet, but based on your poor understanding of some of the basics here I fear you are not ready for these more advanced techniques.

Dale

p.s. There is a Firefox UDF - search the forum to find it as it is not distributed with AutoIt

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Thanks. It helps to find the root cause of the problem.

Right. Something is stilling loading while all necessary table figures already displayed using Chrome/Firefox manually.

1. Disabled All the add-on for IE. Loading the page is a bit faster. But still not within a few second for acceptable range.

1.1 Tried _IECreate not waiting. IE got the same Autoit error message box.

Line 1852 ...IE.au3...Case $i_index >-1 And $i_index <

$o_object.document.GetElementsByTagNames("table").length......

Error: The requested action...... failed...

It is able to show the top part of screen then need to load all the content before able to interface with the page.

1.2 Use the status of _IEPropertyGet, _IETableGetCollection or _IEGetObjByName or _IEDocReadHTML

Study the possibility for bypass and speed up the page loading and process.

P.S. Need some more programming work to be able to use _IEErrorHandlerRegister.

2. The extra items need long time to load is not used in the table content for analysis.

Now looking at is it possible to ignore the background loading to continue the table to Array? use _IE or _FireFox?

3. Look at the possibility load the table to array use the content from InetRead, _INetGetSource.

All necessary table info is able to store in html format file in seconds with the Inet function.

P.S. Able use StringMid to retrieve the body part of html table quickly.

Will be good if there are function able input html table file to array for processing.

4. Use FireFox UDF if FF.au3 give more flexibility and performance for web page and array handling.

Testing FF.au3 (V0.6.0.0b). Ver. Jun 2009!? Not sure if that's the latest update. FFStart the table web page still very slow. Seems some of the function didn't work with the new FireFox3+. i.e. FFQuit, FFConnect();

FFTableWriteToArray look simple but the example didn't work.

Not sure if worth to spend more time on it.

Lots of work in those different directions. Need to find out which one is better to focus.

To be continue........work to break up this question to the direction of error handling or html table file.

Edited by MaoMao
Link to comment
Share on other sites

You can use _IEErrorHandlerRegister to make COM errors be non-fatal. They you need to loop until your element becomes available.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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...