Jump to content

Get table info from iFrame?


Recommended Posts

Hey,

Not with just _IETableGetCollection because an IFrame contains another (HTML) file,

you will first have to get the src element of the IFrame(s) and then do each iframe page seperate and combine the result.

This should get you started. (maybe it can be done with _IE* functions but I went for the regex)

#include <Array.au3>
; $sSource should be a string with the content of the HTML file.
Dim $sSource = 'The material below comes from the website http://example.com/ ' & _
        '<iframe src="http://example.com/" height="200">Alternative text for browsers that do not understand IFrames.</iframe>'
; regular expression to get the src's of the iframes.
Dim $aIFrameSrc = StringRegExp($sSource, "(?i)<iframe.*?src=[\x22\x27](.+?)[\x22\x27]", 3) ; \x22 = " \x27 = '
If Not IsArray($aIFrameSrc) Then 
    ; no iframe src's found
Else    
    ; now you have an array with the links to the contents of the iframes.
    _ArrayDisplay($aIFrameSrc)
EndIf
Edited by Robjong
Link to comment
Share on other sites

Thanks for the help.

I found another way around it, but thanks anyway. =)

I have managed to get the information into an array which looks like this:

[0]|Number:|070-XXXXXXX

[1]|0|

[2]|0|

[3]|0|

[4]|Present balance is:|334 Kr

[5]|0|

[6]|0|

[7]|0|

[8]|Expiration date:|2009-10-12 kl. 03.00

[9]|0|

[10]|

When I use _ExcelWriteCell, I get only "Number" into the first cell of the Excel sheet.

When using _ExcelWriteArray, I don't get anything at all.

All I want is the phone number, balance and expiration date into separate columns in Excel, but for some reason it doesn't want to work the way I want. =)

Here is that part of my code:

CODE
; 3 --- Find table info in iframe

_IENavigate ($oIE, "https://mobil.tewss.telia.se/secbalance/Balance.do?method=init&portalId=FW&abortURL=https%3A%2F%2Fwww.tewss.telia.se%2Fforetag%2Fengagements%2FshowEngagements.do%3FengagementController%3DBalanceMobileCompanyCtrl%26engagementArticle%3DMAIN1_Foretag_MobiltFakturorOchSaldo%26tabId%3D1%26channelId%3D-1610713278")

$oTable = _IETableGetCollection ($oIE, 4)

$aTableData = _IETableWriteToArray ($oTable, True)

;_ArrayDisplay($aTableData) ; Delete ; sign at the beginning to list information

; <-------- Everything okay

; 5 --- Paste the information into an excel file

Local $oExcel = _ExcelBookNew() ;Create new book, make it visible

_ExcelWriteArray($oExcel, $aTableData, 1, 1) ;Write to the Cell

What have I missed?

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