cageman Posted August 12, 2010 Share Posted August 12, 2010 (edited) I asked a question today about StringRegExp(). Now this works, but i have a problem. I do this multiple times and i need to store all these requests in one array. I have a little idea what the size will be, but its better if i have an array with the correct amount of entries instead of some empty entries right? now after each add the array redims and its not a good solution. My code: dim $i,$currentsize,$newsize,$totallinks[1],$links[0] do $i=$i+1 $hResponse=getresponse($i) $currentsize=Ubound($links) local $links[2]=StringRegExp($hResponse,"(?:link.asp\?id=)(\d+)",3) $newsize=Ubound($players) sleep(100) _ArrayConcatenate($totallinks, $links) Until ($currentsize=$newsize) now $totallinks should contain all the links? don't worry about my function getresponse(), it just gets a new html string with data for every $i. Edited August 12, 2010 by cageman Link to comment Share on other sites More sharing options...
jaberwacky Posted August 12, 2010 Share Posted August 12, 2010 You can't have an array of zero elements: $links[0]. Maybe something like this?... Dim $i, $currentsize, $newsize, $totallinks[1], $links[1] Do $i = $i + 1 $hResponse = getresponse($i) $currentsize = UBound($links) _ArrayAdd($links, StringRegExp($hResponse, "(?:link.asp\?id=)(\d+)", 3)) $newsize = UBound($players) Sleep(100) _ArrayConcatenate($totallinks, $links) Until ($currentsize = $newsize) Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? 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