Jump to content
Sign in to follow this  
dar100111

Need help with pulling specific data in a table on a website.

Recommended Posts

dar100111

Hey All,
 
I'm creating a script that is tracking reference numbers on a website.  The information when tracked comes back in an array.  It's pulling the references from an Excel sheet already and I want to be able to pull certain columns from the table and enter into the field.  I created a loop that is working fine right now and just having a hard time to figure out how to select a certain column in a certain row.  See my example for the estimated available field below
 
Would I write the table to an array?  And how would I be able to determine the column or location in the array so that I could write it back to my excel document?

I've got everything working fine except for this part.
 
Sorry I'm pretty new to programming in general so thanks for the help!
 

table screen shot.docx

Edited by dar100111

Share this post


Link to post
Share on other sites
JLogan3o13

Hi, dar100111. Can you give an example of what the table would look like? It would be easier to assist in pulling the specific index if we can see the number of rows and columns.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
dar100111

Hey JLogan.  I submitted a word document that I put a screen shot that is available now up top. 

The form name on the page is "frmQuikTracSummary"  I want to be able to index the columns in "row0" on the example.

Share this post


Link to post
Share on other sites
Chimp

do you want to extract a table from a web page and copy it's content into an array?, if so, you can use IE.au3 in this way:

#include <IE.au3>
#include <Array.au3>
$sUrl = "http://free-tv.ie/astra-satellite-frequencies" ; example url
$oIE = _IECreate($sUrl) ; Create an Internet Explorer Browser Window
_IELoadWait($oIE) ; Wait for a browser page load to complete before returning
$oTable = _IETableGetCollection($oIE, 0) ; 0 = select first table on page.
$aTableData = _IETableWriteToArray($oTable, True) ; Reads the contents of a Table into an array
 _ArrayDisplay($aTableData)

 


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
dar100111

Thanks for the help Pincopanco.  Pulling the array isn't my main concern but how to index a certain column or row in the array, since I want to write pieces back to my excel document.

Share this post


Link to post
Share on other sites
jdelaney

two ways, dynamically loop through the array for the header information you need, and then use that reference to get the data...or, if that table is static, define it.

;dynamic
$sTableDataToLookFor = "title_of_header"
$iTableDataToLookFor = -1
For $i = 0 To UBound($aTable,2) - 1
    If $aTable[0][$i] = $sTableDataToLookFor Then
        $iTableDataToLookFor = $i
        ExitLoop
    EndIf       
Next

If $iTableDataToLookFor < 0 Then
    MsgBox(1,1,"couldn't find data point to search for in the array")
Else
    MsgBox(1,1,"data=" & $aTable[1][$iTableDataToLookFor])  
EndIf

;fixed:
$iTableDataToLookFor = 3
MsgBox(1,1,"data=" & $aTable[1][$iTableDataToLookFor])

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
dar100111

I really appreciate all the help so far.  I'm this much closer.  So i found the correcty array but I would think there still has to be an index of some sort that I can save to my variable to input back into excel.  The table looks like this below with the brackets seperating the columns.  This is the arraydisplay that I copied from my clipboard and pasted.

If I wanted to pull the pieces and save it to a variable.  I still can't figure out how to read Row 1, Column 4, which is the "3" represented; to the right of "SAN" below.

Is there a function that does that from an array?

[0]|Reference Number|Current Status|Origin|Dest|Pieces|Weight|Last Handled|POD Information|Estimated Available (L)|Estimated Charges|Docs
[1]|43558693|Arrived At Destination|ORD|SAN|3|3509.0 L |SAN|Signed By: -Date: -|05/17/2013 13:00 |$998.25|0
 

Share this post


Link to post
Share on other sites
dar100111

Didn't realize it was just $index = $array[1][3] Thanks for all the help guys. Script working and just saved a worker about 4 hours a day woot!

Share this post


Link to post
Share on other sites
jdelaney

I'd like to dispute that best answer :P...especially since I have that exact method defined in pst #6...the 'fixed' route

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
JLogan3o13

To show your appreciation for all the help, you may want to select someone else's post as the best answer - rather than your own.


√-1 2^3 ∑ π, and it was delicious!

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  

×