qwertylol Posted July 18, 2007 Share Posted July 18, 2007 Dim $record Dim $number_handle_there_already_is Dim $is_it_new_handle $number_handle_there_already_is = iniRead ( "handles.ini", 0, "number", "") $counter = 0 $handle_array = winlist ( "txt" ) ;~ If $record = $handle_array[0][0] Then ;~ MsgBox ( 0, "handle fault", "there isn't a new handle when winlist is called.") ;~ EndIf If ($handle_array[0][0] - $record ) > 1 Then MsgBox ( 0, "handle fault", "there is more than one new handle when winlist is called.") EndIf $array_live = winlist ("star wars galaxies") ; theoretically always bigger with 1 $array_record = IniRead ( "handle.ini", 1, "number", "") $counter_1 = 0 $counter_2 = 0 Do $counter_1 = $counter_1 + 1 Do $counter_2 = $counter_2 + 1 $c = IniRead ("handles.ini", 1, $counter_2, "") If $array_live[$counter_1][1] = $c Then $is_it_new_handle = true EndIf if $is_it_new_handle = true Then fileopen ( "newhandle.txt", 2) FileWriteLine ( "newhandle.txt", $array_live[$counter_1][1] ) IniWrite ( "handles.ini", 1, ($number_handle_there_already_is + 1 ), $array_live[$counter_1][1] ) EndIf $is_new_handle = false Until $counter_2 = $number_handle_there_already_is $counter_2 = 0 Until $counter_1 = $handle_array[0][0] the syntax checked fine, yet when run this is returned: >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\python_codes\handle.au3" C:\python_codes\handle.au3 (34) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: If $array_live[$counter_1][1] = $c Then If ^ ERROR >Exit code: 1 Time: 0.350 Link to comment Share on other sites More sharing options...
weaponx Posted July 18, 2007 Share Posted July 18, 2007 It still runs infinitely since I don't really know what its doing expandcollapse popup#include <Array.au3> Dim $record Dim $number_handle_there_already_is Dim $is_it_new_handle $number_handle_there_already_is = iniRead ( "handles.ini", 0, "number", "") $counter = 0 $handle_array = winlist ( "txt" ) ;~ If $record = $handle_array[0][0] Then ;~ MsgBox ( 0, "handle fault", "there isn't a new handle when winlist is called.") ;~ EndIf If ($handle_array[0][0] - $record ) > 1 Then MsgBox ( 0, "handle fault", "there is more than one new handle when winlist is called.") EndIf MsgBox(0,"",$handle_array[0][0]) $array_live = winlist ("SciTE") ; theoretically always bigger with 1 ;$array_live = winlist ("star wars galaxies") ; theoretically always bigger with 1 ;_ArrayDisplay($array_live) ;Check if any windows are returned If ($array_live[0][0] = 0) Then MsgBox(0,"","ERROR - No matching windows found") Else $array_record = IniRead ( "handle.ini", 1, "number", "") $counter_1 = 0 $counter_2 = 0 Do $counter_1 += 1 Do $counter_2 = += 1 $c = IniRead ("handles.ini", 1, $counter_2, "") If $array_live[$counter_1][1] = $c Then $is_it_new_handle = true EndIf if $is_it_new_handle = true Then fileopen ( "newhandle.txt", 2) FileWriteLine ( "newhandle.txt", $array_live[$counter_1][1] ) IniWrite ( "handles.ini", 1, ($number_handle_there_already_is + 1 ), $array_live[$counter_1][1] ) EndIf $is_new_handle = false Until $counter_2 = $number_handle_there_already_is $counter_2 = 0 Until $counter_1 = $handle_array[0][0] ;You are setting $counter_1 to 1 on the first run, it will never be zero EndIf Link to comment Share on other sites More sharing options...
qwertylol Posted July 18, 2007 Author Share Posted July 18, 2007 do you see the same warning? i know when the handles.ini doesn't have any entries, it's an infinite loop. Link to comment Share on other sites More sharing options...
smashly Posted July 18, 2007 Share Posted July 18, 2007 Pretty obvious why you get the error.. the $array_live[$counter_1][1] is invalid if if there isn't a window with the title "star wars galaxies". $counter_1 = 1 on the first loop... So the return from $array_live = winlist ("star wars galaxies") wouldn't have $array_live[$counter_1][1] value. Get how many windows match your Title.. $array_live[0][0] holds how many handels/titles that match your requested winlist. So the counter shouldn't be greater then $array_live[0][0] amount , otherwise you get the error your getting. Have you ever thought of using a MsgBox to debug what you write? Cheers Link to comment Share on other sites More sharing options...
qwertylol Posted July 18, 2007 Author Share Posted July 18, 2007 oh yeah, sorry i got back to this thread when I finished debugging the stuff, yeah i got 8 msgboxes all over the place. 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