Jump to content

Recommended Posts

Posted

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!!

Posted

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!

Posted (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 by ThomasQ
Posted

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?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...