jmp Posted August 5, 2019 Share Posted August 5, 2019 Hello, When I click on Okra tab Figure 1️⃣ Open new page like this : Figure 2️⃣ When i click Potatoes tab it also open new page like this : Figure 3️⃣ But i want to print this two document in one page, like this : 1. First Identify the lower number written Before the item in figure 1 (30, 31) 2. Click on lower number tab and copy the elements of potatoes or any lower number item 3. Return to figure 1 and click on higher number item like Okra (Have 31 number) 4. Past the copied elements before the Okra's elements 5. Set no. in first tab like 1,2,3... 4. Sum the price of all elements and set it to total price 5. sum the total price and labour charge and set it to total paid amount I hope you understand my bad english html code of Figure 1️⃣ Figure 2️⃣ : Figure 3️⃣ : Link to comment Share on other sites More sharing options...
Nine Posted August 5, 2019 Share Posted August 5, 2019 We don't have enough information to give you an exact answer. #1 is obviously a table, look at _IE_Table* function to reach the right table and read it into an array. As for the rest, try producing some code so we can understand what you are trying to do... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
jmp Posted August 7, 2019 Author Share Posted August 7, 2019 On 8/5/2019 at 7:51 PM, Nine said: We don't have enough information to give you an exact answer. #1 is obviously a table, look at _IE_Table* function to reach the right table and read it into an array. As for the rest, try producing some code so we can understand what you are trying to do... @Nine, I tried to get table using : #include <IE.au3> #include <Array.au3> $oIE = _IEAttach ("Shop") $oTable = _IETableGetCollection ($oIE, 0) $aTableData = _IETableWriteToArray ($oTable) $iNumTables = @extended MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page") _ArrayDisplay($aTableData) But, It did not find any table. and I don't want to read the whole table, I want to read the all number that is written before the items. Then identify which is the smaller number of them. Link to comment Share on other sites More sharing options...
Nine Posted August 7, 2019 Share Posted August 7, 2019 (edited) I know what you want. The problem is that I don't have enough info to help you (DOM is too partial). You are telling us that there is no table, but $iNumTables is placed wrong. It should be after the get collection ! Remove the 0 in the get collection, so you know how many tables you have. Check for @error at each step... Edited August 7, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
jmp Posted August 8, 2019 Author Share Posted August 8, 2019 14 hours ago, Nine said: I know what you want. The problem is that I don't have enough info to help you (DOM is too partial). You are telling us that there is no table, but $iNumTables is placed wrong. It should be after the get collection ! Remove the 0 in the get collection, so you know how many tables you have. Check for @error at each step... @Nine i am getting two tables using : #include <IE.au3> #include <Array.au3> $oIE = _IEAttach ("Shop") $oTable = _IETableGetCollection ($oIE, 1) $iNumTables = @extended $aTableData = _IETableWriteToArray ($oTable) MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page") _ArrayDisplay($aTableData) Now, How can i read the all number that is written before the items then identify which is the smallest number of them ? Link to comment Share on other sites More sharing options...
jmp Posted August 10, 2019 Author Share Posted August 10, 2019 I am get table using : #include <IE.au3> #include <Array.au3> $oIE = _IEAttach ("Shop") $oTable = _IETableGetCollection ($oIE, 1) $aTableData = _IETableWriteToArray ($oTable) Local $aExtract = _ArrayExtract($aTableData, 0, 5, 1, 1) _ArrayDisplay($aExtract, "Row 1-2 cols 2-3") How Can i insert it before Okra Row ? HTML : I am trying using : Local $oDiv = _IEGetObjById($oIE, "itemDetails") _IEDocInsertHTML($oDiv, $aExtract, "afterend") But it was not working Link to comment Share on other sites More sharing options...
Nine Posted August 10, 2019 Share Posted August 10, 2019 (edited) If you have read the help file, you would have seen that the second parameter of _IEDocInsertHTML is a string not an array. If you had look at the example, you would have noted, that the string is HTML formatted tags. Now that you know that, you will have to copy the desired tags (from the DOM you posted) into a string like : Local $sHTML = _ '<tr>' & @CRLF & _ ' <td>%1%</td>' & @CRLF & _ ' <td>%2%</td>' & @CRLF & _ ' <td style="text-align: left;">%3%</td>' & @CRLF & _ .... '</tr>' Then you will use _IETagGetCollection to locate the tr object of Okra, You will replace %1%, %2%, etc with the right values coming from your array, and use _IEDocInsertHTML to insert the string after the object found. And please do not ask me to provide you with the code, I will not do it for you. By now you should be able to solve this by yourself. Edited August 10, 2019 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted August 10, 2019 Moderators Share Posted August 10, 2019 @jmp Stick to one topic please. Spamming the forum will not get you faster answers. "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...
Nine Posted August 10, 2019 Share Posted August 10, 2019 Instead of using _IETagGetCollection and since you already have the table object, I would suggest you use .firstElementChild and .nextElementSibling properties of the table object to reach the tr object of Okra. See this site for a list of available DOM elements. FrancescoDiMuro 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
jmp Posted August 11, 2019 Author Share Posted August 11, 2019 22 hours ago, JLogan3o13 said: @jmp Stick to one topic please. Spamming the forum will not get you faster answers. Sorry @JLogan3o13 Link to comment Share on other sites More sharing options...
jmp Posted August 11, 2019 Author Share Posted August 11, 2019 (edited) 21 hours ago, Nine said: Instead of using _IETagGetCollection and since you already have the table object, I would suggest you use .firstElementChild and .nextElementSibling properties of the table object to reach the tr object of Okra. See this site for a list of available DOM elements. @Nine i can't understand with this site, please give me little example how can i use it? Edited August 11, 2019 by jmp Link to comment Share on other sites More sharing options...
jmp Posted August 12, 2019 Author Share Posted August 12, 2019 @Subz, @Nine Please help me Link to comment Share on other sites More sharing options...
jmp Posted August 12, 2019 Author Share Posted August 12, 2019 On 8/10/2019 at 4:45 PM, Nine said: If you have read the help file, you would have seen that the second parameter of _IEDocInsertHTML is a string not an array. If you had look at the example, you would have noted, that the string is HTML formatted tags. Now that you know that, you will have to copy the desired tags (from the DOM you posted) into a string like : Local $sHTML = _ '<tr>' & @CRLF & _ ' <td>%1%</td>' & @CRLF & _ ' <td>%2%</td>' & @CRLF & _ ' <td style="text-align: left;">%3%</td>' & @CRLF & _ .... '</tr>' Then you will use _IETagGetCollection to locate the tr object of Okra, You will replace %1%, %2%, etc with the right values coming from your array, and use _IEDocInsertHTML to insert the string after the object found. And please do not ask me to provide you with the code, I will not do it for you. By now you should be able to solve this by yourself. @Nine I am trying to add element using this code #include <IE.au3> $oIE = _IEAttach ("Shop") $oTable = _IETableGetCollection($oIE,0) Local $oTds2 = _IETagNameGetCollection($oIE, "tbody") $iOutStanding1 = $oTds2(1) Local $sHTML = _ '<tr>' & @CRLF & _ ' <td>New Item here</td>' & @CRLF & _ ' <td>Some text here</td>' & @CRLF & _ '</tr>' _IEDocInsertText($iOutStanding1, $sHTML, "afterbegin") But it was add incorrectly like this : Link to comment Share on other sites More sharing options...
jmp Posted August 13, 2019 Author Share Posted August 13, 2019 13 hours ago, jmp said: @Nine I am trying to add element using this code #include <IE.au3> $oIE = _IEAttach ("Shop") $oTable = _IETableGetCollection($oIE,0) Local $oTds2 = _IETagNameGetCollection($oIE, "tbody") $iOutStanding1 = $oTds2(1) Local $sHTML = _ '<tr>' & @CRLF & _ ' <td>New Item here</td>' & @CRLF & _ ' <td>Some text here</td>' & @CRLF & _ '</tr>' _IEDocInsertText($iOutStanding1, $sHTML, "afterbegin") But it was add incorrectly like this : @Nine Please help me Link to comment Share on other sites More sharing options...
jmp Posted August 16, 2019 Author Share Posted August 16, 2019 On 8/12/2019 at 8:37 PM, jmp said: @Nine I am trying to add element using this code #include <IE.au3> $oIE = _IEAttach ("Shop") $oTable = _IETableGetCollection($oIE,0) Local $oTds2 = _IETagNameGetCollection($oIE, "tbody") $iOutStanding1 = $oTds2(1) Local $sHTML = _ '<tr>' & @CRLF & _ ' <td>New Item here</td>' & @CRLF & _ ' <td>Some text here</td>' & @CRLF & _ '</tr>' _IEDocInsertText($iOutStanding1, $sHTML, "afterbegin") But it was add incorrectly like this : Hello @Nine I am adding table using _IEDocInsertHTML. Now, How can i set number in sequence like 1,2,3.... ? Link to comment Share on other sites More sharing options...
junkew Posted August 16, 2019 Share Posted August 16, 2019 It seems like you are trying to manipulate a webshop page. I have severe doubt if that will work as the backend of the shop will not be able to handle your manipuluation of the HTML so as soon as you refresh your changes are gone. You should only be able to manipulate the elements like buttons, images with click or set value. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
jmp Posted August 20, 2019 Author Share Posted August 20, 2019 On 8/17/2019 at 3:49 AM, junkew said: It seems like you are trying to manipulate a webshop page. I have severe doubt if that will work as the backend of the shop will not be able to handle your manipuluation of the HTML so as soon as you refresh your changes are gone. You should only be able to manipulate the elements like buttons, images with click or set value. @junkew I am not trying to manipulate a webshop page, I just try to save paper. 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