jfcby Posted February 14, 2014 Share Posted February 14, 2014 I have a HTML table that I need to automatically get the number of rows and columns and get the value of each cell while looping through the table? An example would be row one would have two columns of data. I've tried the following code from the help file but it list all data in the table. #include <IE.au3> #include <Array.au3> ;Local $oIE = _IE_Example("table") Local $oIE = _IEAttach("Shop") Local $oTable = _IETableGetCollection($oIE, 14) Local $aTableData = _IETableWriteToArray($oTable, True) _ArrayDisplay($aTableData) I tried to modified it using the following code to display row one column one cell data and row one column two cell data to loop through the table but I'm getting a syntax error. #include <IE.au3> #include <Array.au3> Local $oIE = _IEAttach("Shop") $oTable = _IETableGetCollection($oIE, 14) Local $aTableData = _IETableWriteToArray($oTable, True) For $i = 0 To UBound($aTableData) - 1 MsgBox(1,1, $aTableData) ; & " - " & $aTableData[1]) ;<< get syntax error here Next I've read through and tried some scripts in the forum but none have worked. Thank you for your help, Frankie Cooper Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB **** Link to comment Share on other sites More sharing options...
Valuater Posted February 14, 2014 Share Posted February 14, 2014 You can use... or get the code from here... '?do=embed' frameborder='0' data-embedContent>> 8) ScrapeYourself 1 Link to comment Share on other sites More sharing options...
Gianni Posted February 14, 2014 Share Posted February 14, 2014 once you got the table, you have to use data directly from the array. try this: #include <IE.au3> #include <Array.au3> Local $oIE = _IEAttach("Shop") $oTable = _IETableGetCollection($oIE, 14) Local $aTableData = _IETableWriteToArray($oTable, True) MsgBox(0, "row one column one", $aTableData[1][1]) MsgBox(0, "row one column two", $aTableData[1][2]) For $i = 0 To UBound($aTableData) - 1 MsgBox(0, "", $aTableData[$i][1] & " - " & $aTableData[$i][2]) ; ConsoleWrite($aTableData[$i][1] & " - " & $aTableData[$i][2] & @CRLF) ; <-- this is better Next ScrapeYourself 1 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...
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