jmp Posted October 3, 2021 Posted October 3, 2021 First excuse for bad english 😔 I want to get red rounded text from ie table and save it and use it one by one 1. Get Some text from IE table, (Like 4, 9, 17 etc) 2. save it somewhere, 3. Use it one by one for future task (For Selecting Dropdown List HTML : expandcollapse popup<div id="gridName"> <table class="webgrid-table"> <thead> <tr class="webgrid-header"> <th scope="col"> No. </th> <th scope="col"> Name </th> <th scope="col"> Percentage </th> </tr> </thead> <tbody> <tr class="webgrid-row-style"> <td>1</td> <td>4 : ABC</td> <td>100</td> </tr> <tr class="webgrid-alternating-row"> <td>2</td> <td>9 : DEF</td> <td>50</td> </tr> <tr class="webgrid-row-style"> <td>3</td> <td>17 : JSE</td> <td>50.50</td> </tr> <tr class="webgrid-alternating-row"> <td>4</td> <td>61 : XYZ</td> <td>64.50</td> </tr> <tr class="webgrid-row-style"> <td>5</td> <td>73 : FEG</td> <td>72.50</td> </tr> </tbody> </table> </div>
AlessandroAvolio Posted October 3, 2021 Posted October 3, 2021 Hi, you haven't updated us in the other thread, if you solved please mark my answer as a solution. _IETableGetCollection https://www.autoitscript.com/autoit3/docs/libfunctions/_IETableGetCollection.htm
jmp Posted October 3, 2021 Author Posted October 3, 2021 @AlessandroAvolio I already tried _IETableGetCollection but it was showing whole table, i need only some text , (Like 4, 9, 17 etc).
Danp2 Posted October 3, 2021 Posted October 3, 2021 @jmp You'll need to manually extract the desired data after calling _IETableGetCollection Latest Webdriver UDF Release Webdriver Wiki FAQs
AlessandroAvolio Posted October 3, 2021 Posted October 3, 2021 (edited) 38 minutes ago, jmp said: @AlessandroAvolio I already tried _IETableGetCollection but it was showing whole table, i need only some text , (Like 4, 9, 17 etc). After getting the array that contains the whole table, extract the column of the data you are interested in with _ArrayExtract (but not required). Establish rules for identifying substring, for example by concluding that the substring you are interested in is always positioned in the first 3 characters of the string or that it is always to the left of a specific set of characters. Get the part of the string you are interested in by accessing the array and using the string manipulation functions: Stringinstr, StringMid, StringLeft etc. Create an array or set of different variables to store the new data for future use. https://www.autoitscript.com/autoit3/docs/libfunctions/_ArrayExtract.htm https://www.autoitscript.com/autoit3/docs/functions/String Management.htm Edited October 3, 2021 by AlessandroAvolio
jmp Posted October 4, 2021 Author Posted October 4, 2021 @AlessandroAvolioI have Extracted a specific row and column with _ArrayExtract, $oTable = _IETableGetCollection ($oIE, 1) $aTableData = _IETableWriteToArray ($oTable) ;~ $trim = StringLeft($aTableData, 2) Local $aExtract = _ArrayExtract ($aTableData, 3, 3, 1, -1) _ArrayDisplay($aExtract) Now How can i Extract first 1 or 2 characters? and How to save it somewhere as new data ?
AlessandroAvolio Posted October 4, 2021 Posted October 4, 2021 Those are very simple questions you ask me. You can save the new data by declaring an array or series of variables at the beginning of your program. You can assign them the value you get by processing strings for use in the future. As I have already written to you, you can use Stringleft to extract the first few characters of a string. If you need to know how to access an array, read this: https://www.autoitscript.com/wiki/Arrays
AlessandroAvolio Posted October 4, 2021 Posted October 4, 2021 #include <Array.au3> Local $aArray[4][3] = [["aaa", "bbb", "ccc"], ["aaa", "bbb", "ccc"], ["aaa", "bbb", "ccc"], ["aaa", "bbb", "ccc"]] Local $aSubstrings[4] _ArrayDisplay($aArray) For $i = 0 To UBound($aArray) - 1 $aSubstrings[$i] = StringLeft($aArray[$i][1], 2) Next _ArrayDisplay($aSubstrings) An example for you
jmp Posted October 4, 2021 Author Posted October 4, 2021 2 hours ago, AlessandroAvolio said: #include <Array.au3> Local $aArray[4][3] = [["aaa", "bbb", "ccc"], ["aaa", "bbb", "ccc"], ["aaa", "bbb", "ccc"], ["aaa", "bbb", "ccc"]] Local $aSubstrings[4] _ArrayDisplay($aArray) For $i = 0 To UBound($aArray) - 1 $aSubstrings[$i] = StringLeft($aArray[$i][1], 2) Next _ArrayDisplay($aSubstrings) An example for you In my case Rows Count changed everytime, Then how can i use Local $aSubstrings[4] ?
AlessandroAvolio Posted October 4, 2021 Posted October 4, 2021 2 minutes ago, jmp said: In my case Rows Count changed everytime, Then how can i use Local $aSubstrings[4] ? With Ubound() https://www.autoitscript.com/autoit3/docs/functions/UBound.htm
jmp Posted October 4, 2021 Author Posted October 4, 2021 3 hours ago, AlessandroAvolio said: #include <Array.au3> Local $aArray[4][3] = [["aaa", "bbb", "ccc"], ["aaa", "bbb", "ccc"], ["aaa", "bbb", "ccc"], ["aaa", "bbb", "ccc"]] Local $aSubstrings[4] _ArrayDisplay($aArray) For $i = 0 To UBound($aArray) - 1 $aSubstrings[$i] = StringLeft($aArray[$i][1], 2) Next _ArrayDisplay($aSubstrings) An example for you This is example for Rows. Can you give me Example for Column ?
AlessandroAvolio Posted October 4, 2021 Posted October 4, 2021 (edited) 25 minutes ago, jmp said: This is example for Rows. Can you give me Example for Column ? #include <Array.au3> Local $aArray[4][3] = [["a", "b", "c"], ["aa", "bb", "cc"], ["aaa", "bbb", "ccc"], ["aaaa", "bbbb", "cccc"]] Local Const $iArrayNumberOfCols = UBound($aArray, $UBOUND_COLUMNS) Local Const $iArrayNumberOfRows = UBound($aArray, $UBOUND_ROWS) Local Const $iArrayColIndex = 1 Local Const $iArrayRowIndex = 2 Local $aArraySubstringsColumn[$iArrayNumberOfRows] Local $aArraySubstringsRow[$iArrayNumberOfCols] Local $sSubstring _ArrayDisplay($aArray) For $i = 0 To $iArrayNumberOfRows - 1 $sSubstring = StringLeft($aArray[$i][$iArrayColIndex], 2) $aArraySubstringsColumn[$i] = $sSubstring Next _ArrayDisplay($aArraySubstringsColumn, "This is a col") For $i = 0 To $iArrayNumberOfCols - 1 $sSubstring = StringLeft($aArray[$iArrayRowIndex][$i], 2) $aArraySubstringsRow[$i] = $sSubstring Next _ArrayDisplay($aArraySubstringsRow, "This is a row") The example already posted involved iterating a column in the array. To have the same result but on a row, simply reverse the logic of the first example. If the question seems simple to you, try first looking for a solution yourself before writing! You will become familiar with the language Edited October 4, 2021 by AlessandroAvolio
jmp Posted October 4, 2021 Author Posted October 4, 2021 42 minutes ago, AlessandroAvolio said: #include <Array.au3> Local $aArray[4][3] = [["a", "b", "c"], ["aa", "bb", "cc"], ["aaa", "bbb", "ccc"], ["aaaa", "bbbb", "cccc"]] Local Const $iArrayNumberOfCols = UBound($aArray, $UBOUND_COLUMNS) Local Const $iArrayNumberOfRows = UBound($aArray, $UBOUND_ROWS) Local Const $iArrayColIndex = 1 Local Const $iArrayRowIndex = 2 Local $aArraySubstringsColumn[$iArrayNumberOfRows] Local $aArraySubstringsRow[$iArrayNumberOfCols] Local $sSubstring _ArrayDisplay($aArray) For $i = 0 To $iArrayNumberOfRows - 1 $sSubstring = StringLeft($aArray[$i][$iArrayColIndex], 2) $aArraySubstringsColumn[$i] = $sSubstring Next _ArrayDisplay($aArraySubstringsColumn, "This is a col") For $i = 0 To $iArrayNumberOfCols - 1 $sSubstring = StringLeft($aArray[$iArrayRowIndex][$i], 2) $aArraySubstringsRow[$i] = $sSubstring Next _ArrayDisplay($aArraySubstringsRow, "This is a row") The example already posted involved iterating a column in the array. To have the same result but on a row, simply reverse the logic of the first example. If the question seems simple to you, try first looking for a solution yourself before writing! You will become familiar with the language Thanks @AlessandroAvolio I tried it : $oTable = _IETableGetCollection ($oIE, 1) $aTableData = _IETableWriteToArray ($oTable) Local Const $iArrayNumberOfCols = UBound($aTableData, $UBOUND_COLUMNS) Local Const $iArrayNumberOfRows = UBound($aTableData, $UBOUND_ROWS) Local $aArraySubstringsRow[$iArrayNumberOfCols] ;~ Local $aExtract = _ArrayExtract ($aTableData, 1, 1, 1, -1) ;~ MsgBox(0, "", $iArrayNumberOfCols) ;~ _ArrayDisplay($aExtract) Local Const $iArrayRowIndex = 1 Local $sSubstring For $i = 0 To $iArrayNumberOfCols - 1 $sSubstring = StringLeft($aTableData[$iArrayRowIndex][$i], 2) $aArraySubstringsRow[$i] = $sSubstring Next _ArrayDisplay($aArraySubstringsRow, "This is a row") But i want to skip First Col. i am changed For $i = 0 To $iArrayNumberOfCols - 1 to For $i = 1 To $iArrayNumberOfCols - 1. But it was showing Blank, Not Skipped.
AlessandroAvolio Posted October 4, 2021 Posted October 4, 2021 In this case you can delete the first element of $aArraySubstringsRow using _ArrayDelete https://www.autoitscript.com/autoit3/docs/libfunctions/_ArrayDelete.htm
jmp Posted October 4, 2021 Author Posted October 4, 2021 (edited) 12 hours ago, AlessandroAvolio said: In this case you can delete the first element of $aArraySubstringsRow using _ArrayDelete https://www.autoitscript.com/autoit3/docs/libfunctions/_ArrayDelete.htm @AlessandroAvolio How to show cell one by one in msgbox? Please give an example. Edited October 5, 2021 by jmp
jmp Posted October 5, 2021 Author Posted October 5, 2021 @Danp2 Please give help me, i am waiting for solution. $oTable = _IETableGetCollection ($oIE, 1) $aTableData = _IETableWriteToArray ($oTable) Local Const $iArrayNumberOfCols = UBound($aTableData, $UBOUND_COLUMNS) Local Const $iArrayNumberOfRows = UBound($aTableData, $UBOUND_ROWS) Local $aArraySubstringsRow[$iArrayNumberOfCols] ;~ Local $aExtract = _ArrayExtract ($aTableData, 1, 1, 1, -1) ;~ MsgBox(0, "", $iArrayNumberOfCols) ;~ _ArrayDisplay($aExtract) Local Const $iArrayRowIndex = 1 Local $sSubstring For $i = 0 To $iArrayNumberOfCols - 1 $sSubstring = StringLeft($aTableData[$iArrayRowIndex][$i], 2) $aArraySubstringsRow[$i] = $sSubstring Next _ArrayDisplay($aArraySubstringsRow, "This is a row") I am Extracted text using above code. Now i want to use it one by one for selecting dropdown box. So, how can i get one by one cell ? Please give me example of msbox.
Solution AlessandroAvolio Posted October 5, 2021 Solution Posted October 5, 2021 7 minutes ago, jmp said: @Danp2 Please give help me, i am waiting for solution. $oTable = _IETableGetCollection ($oIE, 1) $aTableData = _IETableWriteToArray ($oTable) Local Const $iArrayNumberOfCols = UBound($aTableData, $UBOUND_COLUMNS) Local Const $iArrayNumberOfRows = UBound($aTableData, $UBOUND_ROWS) Local $aArraySubstringsRow[$iArrayNumberOfCols] ;~ Local $aExtract = _ArrayExtract ($aTableData, 1, 1, 1, -1) ;~ MsgBox(0, "", $iArrayNumberOfCols) ;~ _ArrayDisplay($aExtract) Local Const $iArrayRowIndex = 1 Local $sSubstring For $i = 0 To $iArrayNumberOfCols - 1 $sSubstring = StringLeft($aTableData[$iArrayRowIndex][$i], 2) $aArraySubstringsRow[$i] = $sSubstring Next _ArrayDisplay($aArraySubstringsRow, "This is a row") I am Extracted text using above code. Now i want to use it one by one for selecting dropdown box. So, how can i get one by one cell ? Please give me example of msbox. You have received replies on the topic specified in the title of the discussion. For new questions please mark the solution in this thread and open a new thread.
Danp2 Posted October 5, 2021 Posted October 5, 2021 4 hours ago, AlessandroAvolio said: You have received replies on the topic specified in the title of the discussion. For new questions please mark the solution in this thread and open a new thread. I disagree. Starting a new thread just leads to a bunch of fragmentation when the discussion is essentially on the same "issue", which leads to those trying to help having to flip back and forth between the threads to have a proper understanding of what discussions have already taken place. 4 hours ago, jmp said: Please give help me, i am waiting for solution. IMO, you need to work on becoming more self sufficient. Many of these questions can be answered yourself by using resources such as the help file, the wiki, existing example code, etc. TheXman 1 Latest Webdriver UDF Release Webdriver Wiki FAQs
AlessandroAvolio Posted October 5, 2021 Posted October 5, 2021 (edited) On 10/5/2021 at 7:51 PM, Danp2 said: I disagree. Starting a new thread just leads to a bunch of fragmentation when the discussion is essentially on the same "issue", which leads to those trying to help having to flip back and forth between the threads to have a proper understanding of what discussions have already taken place. 👍 Edited December 14, 2021 by AlessandroAvolio
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