Jump to content
Sign in to follow this  

Problem with appending to arrays with loop

Recommended Posts


Ok, here's the deal....I've successfully gotten this to load up the first page of friends, extract the links, search the source of every profile on the first page for my friendID, and populate the matching data into array2...Here's the issue. When it switches to page 2 after populating array2, it doesn't perform the link extraction and source search on any page after the first. It just keeps cycling through the pages and displays the incomplete arrays. What am I doing wrong with the loop?

#include <IE.au3>




#include <INet.au3>

Dim $avArray[1]

Dim $avArray2[1]

$i = 2

Global $friendID = "32406107"

Global $oIE = _IECreate("http://friends.myspace.com/index.cfm?fuseaction=user.viewfriends&friendID=" & $friendID)

$oLinks = _IELinkGetCollection($oIE)

Global $sHref = "profile"

While $i <= 5;;;;;;;;;;;;;;;;;;;;;;;;;;;;

For $oLink In $oLinks

_ArrayAdd($avArray, $oLink.href)

If StringInStr(String($oLink.href), $sHref) Then


If StringInStr(_INetGetSource($oLink.href), '32406107') > 0 Then

_ArraySearch($avArray2, $oLink.href, 0, 0, 0, True)

If @error Then _ArrayAdd($avArray2, $oLink.href)



$oLinks = _IELinkGetCollection($oIE)

$oSubmit = "java script:__doPostBack('ctl00$cpMain$pagerTop','" & $i & "')"

_IENavigate($oIE, $oSubmit)

$i = $i + 1


_ArrayDisplay($avArray, "Whole array")

_ArrayDisplay($avArray2, "Whole array")

Edited by DigitalLocksmith

Share this post

Link to post
Share on other sites

No, that's not it either because I think the _IELinkGetCollection isn't working when I do this so it ends up being a completely empty array....I'm stumped, but I'll keep trying...Is _ArrayAdd overwriting $array, or does it always append to the end?

Edited by DigitalLocksmith

Share this post

Link to post
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
Sign in to follow this