mcfr1es Posted August 13, 2004 Share Posted August 13, 2004 (edited) Here i go again.... I had a certain function in my script ( GetUsers_ ) that has been finished for a while and has been running smoothly. After changing something in my main script, when I tried to run it, I got an error that $sUserList in Func GetUsers_ is not declared. The problem is that I did not touch that function.. Any Ideas? Heres my main script and the getUsers_ function: NOTE: the _nameURL function returns a diff url each time expandcollapse popup$numnames = 0 $runtime = 0 Dim $AllUsers [1] $f = 0 Dim $PageNames [ 50 ] [2000] $count = 0 $PageNames = _NameURL() For $aa = 1 to 24 Step 1 For $bb = 1 to 1001 Step 50 $sURL = $Pagenames [$aa] [$bb] $UserList = _GetUsers($sURL) $numnames = $numnames +50 For $vv = 0 to 49 If $runtime = 0 Then $f = $f+50 ReDim $AllUsers [$f] $AllUsers [$vv] = $UserList [$vv] Else For $uu = 0 to $numnames - 1 If $AllUsers [$uu] <> $UserList [$vv] Then $f = $f + 1 ReDim $AllUsers [$f] TrayTip("tit","numnames= " & $numnames & " f= " & $f , 5, 1) $AllUsers [$f] = $UserList [$vv] EndIf Next Endif Next $runtime = 1 Next Next $filename = "users.txt" FileOpen ($filename, 1) ;Check if file opened for writing OK If $filename = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileClose ($filename) Func _GetUsers($psURL) ;Returns an array of links from a webpage ;------------------------------------------------------------------------------ ;Download the HTML to a temporary file $sTempFile = "$page.htm" URLDownloadToFile($psURL, $sTempFile) $sHTML = FileRead($sTempFile, FileGetSize($sTempFile)) FileDelete($sTempFile) ;Cleanup the HTML for better consumption $sHTML = StringReplace($sHTML, @CR, "") $sHTML = StringReplace($sHTML, @LF, "") $sHTML = StringReplace($sHTML, @TAB, " ") ;Break it into chewable bytes $sHTML = StringReplace($sHTML, '<span class="blistSmall">', @LF & '<span class="blistSmall">') $asHTML = StringSplit($sHTML, @LF) ;Spit out the bones For $nX = 1 to $asHTML[0] ;Process only "<span class="blistSmall">" lines If StringLeft($asHTML[$nX],25) = '<span class="blistSmall">' then $asUserlist = Stringtrimleft($asHTML[$nX], StringInStr($asHTML[$nX],">")) $asUserlist = Stringleft($asUserlist, StringInStr($asUserlist,"<")-1) $sUserlist = $sUserlist & @LF & $asUserlist Endif Next ;Return the juicy links Return StringSplit(StringTrimLeft($sUserlist , 1 ), @LF) EndFunc Edited August 13, 2004 by mcfr1es Roger! You son of a big pile o' Monkey Nuts. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 13, 2004 Developers Share Posted August 13, 2004 It probably never reaches this: $asUserlist = Stringtrimleft($asHTML[$nX], StringInStr($asHTML[$nX],">")) Before getting to the end... Add this just below the FUNC statement: Local $sUserList which will ensure it is defined.... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mcfr1es Posted August 13, 2004 Author Share Posted August 13, 2004 (edited) It probably never reaches this: $asUserlist = Stringtrimleft($asHTML[$nX], StringInStr($asHTML[$nX],">")) Before getting to the end... Add this just below the FUNC statement: Local $sUserList which will ensure it is defined.... <{POST_SNAPBACK}>what would we ever do without JdeB EDIT: Thank you very much, but in this function, the userlist array doesnt seem to be populating, any ideas? I ve been worknig on this for over a week and its driving me crazy, I must have written 50 revisions to the code and still no result... the thing that gets me though is that it was perfectly fine a day ago and I havent changd anything in that function since then... There is currently an error on line 22, $UserList [$vv] is exceeding its subscript dimension range.. The only place this could happen is in the _getUsers func. i believe. Also, why is the script not reaching that line of code? It was working perfectly before Edited August 13, 2004 by mcfr1es Roger! You son of a big pile o' Monkey Nuts. 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