Jump to content

[SOLVED] Help with Array's (creating 1 Array from 2 Arrays)


Dent
 Share

Recommended Posts

I just can't get my head around what I'm trying to do.

Ok so I read all the links in a webpage into a 1D array, I then make the array unique as there are some duplicates.

I then find all the entries I want from the array and put the number of the row for those entries into another 1D array.

So I now have two arrays; one has unique links, the other has the numbers of the rows for the links I actually want.

Using the second array I would like to amend the first array, or create a third, with just the links I actually want.

Confused? Welcome to my world.

I'll put the relevant section of code below to show where I am up to.

I've left the _ArrayDisplay in the above code which I am using to check the code does what I wanted. So the above code works fine, I'm just stumped on how to extract the links from $aLinks that I want.

$oLinks = _IELinkGetCollection($oIE)
Local $aLinks[1] = ["Link"]
For $oLink in $oLinks
    _ArrayAdd($aLinks, $oLink.href)
Next
;_ArrayDisplay($aLinks)
$aLinks = _ArrayUnique($aLinks)
;_ArrayDisplay($aLinks)
$aLinksToClick = _ArrayFindAll($aLinks, "azref", 0, 0, 0, 3)
;_ArrayDisplay($aLinksToClick)
Local $aSortedLinks[1] = ["Sorted Links"]

For $i = 0 To UBound($aLinksToClick) - 1
    $Blah = _ArrayExtract($aLinks, $aLinksToClick[$i], $aLinksToClick[$i])
    _ArrayAdd($aSortedLinks, $Blah)
Next

 

Edited by Dent
To include solution
Link to comment
Share on other sites

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
 Share

×
×
  • Create New...