dar100111 Posted May 16, 2013 Share Posted May 16, 2013 (edited) 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 May 16, 2013 by dar100111 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 16, 2013 Moderators Share Posted May 16, 2013 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. "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 More sharing options...
dar100111 Posted May 16, 2013 Author Share Posted May 16, 2013 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. Link to comment Share on other sites More sharing options...
Gianni Posted May 16, 2013 Share Posted May 16, 2013 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) Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
dar100111 Posted May 17, 2013 Author Share Posted May 17, 2013 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. Link to comment Share on other sites More sharing options...
jdelaney Posted May 17, 2013 Share Posted May 17, 2013 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. Link to comment Share on other sites More sharing options...
dar100111 Posted May 17, 2013 Author Share Posted May 17, 2013 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 Link to comment Share on other sites More sharing options...
Solution dar100111 Posted May 17, 2013 Author Solution Share Posted May 17, 2013 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! Link to comment Share on other sites More sharing options...
jdelaney Posted May 17, 2013 Share Posted May 17, 2013 (edited) I'd like to dispute that best answer ...especially since I have that exact method defined in pst #6...the 'fixed' route Edited May 17, 2013 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. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 17, 2013 Moderators Share Posted May 17, 2013 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. "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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now