goldenix Posted March 6, 2008 Share Posted March 6, 2008 Hi. I get this interesting error. the thing is that sometimes it pops up & sometimes it does not, this is really vierd. I did some search, but didnt really find anything I could use to fix this. Any ideas? : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If StringInStr($_Arrayline[$a],$search_For) Then If StringInStr(^ ERROR expandcollapse popup;~====================================================================================== ;~ Get Gallery Name ;~====================================================================================== Func _foldername() ;~ Tis is will get page source code & will put it to array 6 the will search array for spesific text $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET",'http://www.imagefap.com/gallery/1036911') $oHTTP.Send() $HTMLSource = $oHTTP.Responsetext $_Arrayline = StringSplit($HTMLSource, @LF) ; this is the Array $_Arrayline ;~ =============================================== $search_For = '3366cc no-repeat left top' ;~ =============================================== $a = 250 while 1 If StringInStr($_Arrayline[$a],$search_For) Then ; <<<<<<<<< This is the ERROR PLACE if its the line with gallery name $remove_HTML= StringReplace($_Arrayline[$a], '<td style="background: url(/img/win-fff.gif) #3366cc no-repeat left top;"><font face=verdana color=white size=4><b>', "") $foldername = StringTrimRight($remove_HTML, 1); because gallery name has linebreak in the end of the name $foldername = StringReplace($foldername, "\", "") ; replace special chars $foldername = StringReplace($foldername, "*", "") $foldername = StringReplace($foldername, "?", "") $foldername = StringReplace($foldername, "<", "") $foldername = StringReplace($foldername, ">", "") $foldername = StringReplace($foldername, ":", "") if Not FileExists($foldername) Then DirCreate($foldername) ; makedir ExitLoop EndIf $a += 1 WEnd EndFunc My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
rasim Posted March 6, 2008 Share Posted March 6, 2008 Hi! What the [$a]? Mayb you forgot to use For...Next? Link to comment Share on other sites More sharing options...
goldenix Posted March 6, 2008 Author Share Posted March 6, 2008 (edited) Hi! What the [$a]? Mayb you forgot to use For...Next? [$a] is the nr. of the array line. I know that the line i need starts somewhere after line 250 so I start checking array lines from line nr 250,251,252 etc. until i find the line I need & then I get this error $a = 250 ; start count from while 1 If StringInStr($_Arrayline[$a],$search_For) Then show msgbox But instead i get error $a += 1 wend Edited March 6, 2008 by goldenix My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
smashly Posted March 6, 2008 Share Posted March 6, 2008 (edited) You might want to exit the While loop when a certain criteria is met .. eg: _foldername() Func _foldername() ;~ Tis is will get page source code & will put it to array 6 the will search array for spesific text $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", 'http://www.imagefap.com/gallery/1036911') $oHTTP.Send() $HTMLSource = $oHTTP.Responsetext $_Arrayline = StringSplit($HTMLSource, @LF) ; this is the Array $_Arrayline ;~ _ArrayDisplay($_Arrayline, "$_Arrayline") ;~ =============================================== $search_For = '3366cc no-repeat left top' ;~ =============================================== $a = 1 While 1 If $a > $_Arrayline[0] Then ExitLoop If StringInStr($_Arrayline[$a], $search_For) Then MsgBox(0, "$a = " & $a, $_Arrayline[$a]) $a += 1 WEnd EndFunc To me it looks like your not exiting the loop and therefore your hitting the end of the array and $a is greater then the $_Arrayline array and the while loop keeps adding 1 and continuing. Cheers PS. your search string shows in the array around the 190 mark for me. Edited March 6, 2008 by smashly Link to comment Share on other sites More sharing options...
goldenix Posted March 6, 2008 Author Share Posted March 6, 2008 (edited) yup thanx it does seems to be working fine now. Tho its not logical, since it will find the text im searching for 100% & will exit loop before it will reach the end of the array. But i guess this is autoit..... Edited March 6, 2008 by goldenix My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 6, 2008 Moderators Share Posted March 6, 2008 (edited) yup thanx it does seems to be working fine now. Tho its not logical, since it will find the text im searching for 100% & will exit loop before it will reach the end of the array. But i guess this is autoit.....Actually that thinking isn't very logical to me. Why would you go through the entire array if what you are looking for is already found? Seems like a waste of time and resources to me. But... If your item was the last element of the array, it would in fact make to the end wouldn't it? Another way to make it a bit easier on you in the future with less code. Instead of:$a = 1 While 1 If $a > $_Arrayline[0] Then ExitLoop If StringInStr($_Arrayline[$a], $search_For) Then MsgBox(0, "$a = " & $a, $_Arrayline[$a]) $a += 1 WEndoÝ÷ Ù:ò¶¬jëh×6For $a = 1 To $_Arrayline[0] If StringInStr($_Arrayline[$a], $search_For) Then MsgBox(0, "$a = " & $a, $_Arrayline[$a]) Next Edited March 6, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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