GTheAutomator Posted January 8, 2021 Share Posted January 8, 2021 Hello everyone, I'm trying to build a bot that automates downloading files, but for that I must sort the file list first. $a = _IETagNameGetCollection($tag, "a") ConsoleWrite($a & " ") For $link in $a $classField = $link.GetAttribute("class") ConsoleWrite("_" &$classField & "_ ") If $classField = "k-link" Then ConsoleWrite($link.document.GetElementsByTagName("span")) If $link.document.GetElementsByTagName("span") then $spTag = _IETagNameGetCollection($link, "span") ConsoleWrite("_" & $spTag & "_ ") For $span in $spTag $class = $span.GetAttribute("class") ConsoleWrite("_" & $class & "_ ") If $class = "k-icon k-i-arrow-s" Then _IEAction($tag, "click") Sleep(1500) _IEAction($tag, "click") Sleep(1500) ExitLoop ElseIf $class = "k-icon k-i-arrow-n" Then Sleep(1500) ExitLoop EndIf Next Else _IEAction($tag, "click") Sleep(1500) ExitLoop EndIf ExitLoop EndIf Next I build this trying to check the value of the order button and give it the necessary number of presses to order it the right way. this is the HTML tag of the button in unsorted state: <a class="k-link" href="/Monitor/PopulaGrid?gridMonitor-sort=NumeroDocumento-asc">Num Doc</a> When it's ordered (ascending or descending) it's like this: <a class="k-link" href="/Monitor/PopulaGrid?gridMonitor-sort=NumeroDocumento-asc">Num Doc<span class="k-icon k-i-arrow-(x)"></span></a> as you can see when it's sorted a new span tag appears inside the original one that let's you get the order it's sorted. My first thought to solve this is trying to see if this tag exists (if it doesn't i could take proper action, if it does i could check it's value and also act accordingly) but i don't to see to know how to check this. Can someone help me to solve how to do this. Link to comment Share on other sites More sharing options...
Nine Posted January 8, 2021 Share Posted January 8, 2021 That seems to work fine in my test environment : _IELoadWait($oIE) Local $oTags = _IETagNameGetCollection($oIE, "a") Local $sClass, $oLinks, $oSpan For $oTag in $oTags $sClass = $oTag.GetAttribute("class") ConsoleWrite("_" & $sClass & "_" & @CRLF) If $sClass = "k-link" Then $oSpan = $oTag.firstElementChild If IsObj($oSpan) Then ConsoleWrite ("Child Found" & @CRLF) Else ConsoleWrite ("Child not found" & @CRLF) EndIf EndIf Next “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...
GTheAutomator Posted January 11, 2021 Author Share Posted January 11, 2021 @Nine i tried adapting what you did and it seems to have worked. Thanks 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