ThomasQ Posted August 10, 2009 Share Posted August 10, 2009 Hi! I'm building a script to make my work a hell of a lot easier. One of the final steps is that I have to find a way to check the innertext of an url, take a specific part (in this case a number) of the text, and compere it to another one. In this case I have to sort starting with the lowest number Example: With this script I return the innertext, of the gotten links. $oLinks = _IELinkGetCollection ($oIE) Local $iLinkIndex = 16 ; Change this to the index you want Local $iCurrentIndex = 0 For $oLink In $oLinks $iCurrentIndex += 1 If $iCurrentIndex = $iLinkIndex Then $klantmail = _IEPropertyGet($oLink, "innertext") When I get these back - ProductID: 5870729_000 - ProductID: 5870717_000 - ProductID: 5870821_000 I have to identify wich one has the lowest number, then the one after that, etc.. Anyone any good ideas?? Many Thanks in advance!! Link to comment Share on other sites More sharing options...
monoceres Posted August 11, 2009 Share Posted August 11, 2009 Merry christmas. #include <array.au3> $oLinks = _IELinkGetCollection($oIE) Local $iLinkIndex = 16 ; Change this to the index you want Local $iCurrentIndex = 0 Local $Array[1] For $oLink In $oLinks $iCurrentIndex += 1 If $iCurrentIndex = $iLinkIndex Then $klantmail = StringReplace(StringReplace(_IEPropertyGet($oLink, "innertext"), "- ProductID: ", ""), "_", "") If UBound($Array) = 1 Then $Array[0] = $klantmail Else ReDim $Array[UBound($Array) + 1] $Array[UBound($Array) - 1] = $klantmail EndIf EndIf Next _ArraySort($Array) _ArrayDisplay($Array) >_< Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
ThomasQ Posted August 11, 2009 Author Share Posted August 11, 2009 Hahah Thanks! I'll be implementing it tomorrow. Let you know how it went! Link to comment Share on other sites More sharing options...
ThomasQ Posted August 11, 2009 Author Share Posted August 11, 2009 (edited) Well, tried it a couple of times, but no succes. I don't get any results when _Arraydisplays runs.. I do get the building of the array though, but somewhere there must be a little kink in the cable. I also took a good look at the innertext to be sorted, it contains 3 variables: IP* - ProductID: *******-***, where each * is a variable.. $oLinks = _IELinkGetCollection($oIE) Local $Array[1] For $oLink In $oLinks $klantmail = StringReplace(StringReplace(_IEPropertyGet($oLink, "innertext"), "IP2 - ProductID: ", ""), "_", "") If UBound($Array) = 1 Then $Array[0] = $klantmail Else ReDim $Array[uBound($Array) + 1] $Array[uBound($Array) - 1] = $klantmail EndIf Next _ArraySort($Array) _ArrayDisplay($Array) Edited August 11, 2009 by ThomasQ Link to comment Share on other sites More sharing options...
ThomasQ Posted August 11, 2009 Author Share Posted August 11, 2009 Well, this script returns 3 links, with 0 being nothing, and 1 & 2 the wanted links $oLinks = _IELinkGetCollection($oIE) Local $Array[1] For $oLink In $oLinks $klantmail = _IEPropertyGet($oLink, "innertext") $ProductID = StringInStr($klantmail, "ProductID") ConsoleWrite($ProductID & @CRLF) If $ProductID = 7 Then ReDim $Array[uBound($Array) + 1] $Array[uBound($Array) - 1] = $klantmail EndIf Next _ArraySort($Array) _ArrayDisplay($Array) Why does the 0 index of the array has to be clean? Link to comment Share on other sites More sharing options...
Authenticity Posted August 11, 2009 Share Posted August 11, 2009 Recalculating the array using it's upper-bound first result to 1 instead of 0. You can make a string concatenation like: $sString &= $klantmail & '|' ; .... $aLinks = StringSplit(StringTrimLeft($sString, 1), '|', 2) and the array will contain the links starting at index 0 which is the first link. 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