thenewkid Posted April 24, 2007 Share Posted April 24, 2007 im very new to Array this is my 1st time trying to use them i was useing the helpfile to make this part of my script but i get a error and i dont know how to fix it can any one help thanks $file = FileOpen("Score.ini", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") EndIf dim $line[10] $line[1] = FileReadLine($file) $line[2] = FileReadLine($file) $line[3] = FileReadLine($file) $line[4] = FileReadLine($file) $line[5] = FileReadLine($file) $line[6] = FileReadLine($file) $line[7] = FileReadLine($file) $line[8] = FileReadLine($file) $line[9] = FileReadLine($file) $line[10] = FileReadLine($file) FileClose($file) GuiCreate("MyGUI", 335, 323,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Label_1 = GuiCtrlCreateLabel("1" & $line[1], 10, 20, 280, 20) $Label_2 = GuiCtrlCreateLabel("2" & $line[2], 10, 50, 280, 20) $Label_3 = GuiCtrlCreateLabel("3" & $line[3], 10, 80, 280, 20) $Label_4 = GuiCtrlCreateLabel("4" & $line[4], 10, 110, 280, 20) $Label_5 = GuiCtrlCreateLabel("5" & $line[5], 10, 140, 280, 20) $Label_6 = GuiCtrlCreateLabel("6" & $line[6], 10, 170, 280, 20) $Label_7 = GuiCtrlCreateLabel("7" & $line[7], 10, 200, 280, 20) $Label_8 = GuiCtrlCreateLabel("8" & $line[8], 10, 230, 280, 20) $Label_9 = GuiCtrlCreateLabel("9" & $line[9], 10, 260, 280, 20) $Label_10 = GuiCtrlCreateLabel("10" & $line[10], 10, 290, 280, 20) GuiSetState() some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with Link to comment Share on other sites More sharing options...
MerleHaggard Posted April 24, 2007 Share Posted April 24, 2007 im very new to Array this is my 1st time trying to use them i was useing the helpfile to make this part of my script but i get a error and i dont know how to fix it can any one help thanks $file = FileOpen("Score.ini", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") EndIf dim $line[10] $line[1] = FileReadLine($file) $line[2] = FileReadLine($file) $line[3] = FileReadLine($file) $line[4] = FileReadLine($file) $line[5] = FileReadLine($file) $line[6] = FileReadLine($file) $line[7] = FileReadLine($file) $line[8] = FileReadLine($file) $line[9] = FileReadLine($file) $line[10] = FileReadLine($file) FileClose($file) GuiCreate("MyGUI", 335, 323,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Label_1 = GuiCtrlCreateLabel("1" & $line[1], 10, 20, 280, 20) $Label_2 = GuiCtrlCreateLabel("2" & $line[2], 10, 50, 280, 20) $Label_3 = GuiCtrlCreateLabel("3" & $line[3], 10, 80, 280, 20) $Label_4 = GuiCtrlCreateLabel("4" & $line[4], 10, 110, 280, 20) $Label_5 = GuiCtrlCreateLabel("5" & $line[5], 10, 140, 280, 20) $Label_6 = GuiCtrlCreateLabel("6" & $line[6], 10, 170, 280, 20) $Label_7 = GuiCtrlCreateLabel("7" & $line[7], 10, 200, 280, 20) $Label_8 = GuiCtrlCreateLabel("8" & $line[8], 10, 230, 280, 20) $Label_9 = GuiCtrlCreateLabel("9" & $line[9], 10, 260, 280, 20) $Label_10 = GuiCtrlCreateLabel("10" & $line[10], 10, 290, 280, 20) GuiSetState() Which error are you getting? And if the score.ini file isn't in the windows directory, it may be helpful for you to specify it when you attempt to open the file. (i.e. C:\Documents and Settings\NAME\Desktop\score.ini) if the file's located on your desktop Link to comment Share on other sites More sharing options...
thenewkid Posted April 24, 2007 Author Share Posted April 24, 2007 Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $line[10] = FileReadLine($file) and the file is in the same file as the script some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with Link to comment Share on other sites More sharing options...
Helge Posted April 24, 2007 Share Posted April 24, 2007 (edited) The first element in your array isn't $line[1] but $line[0], while the last is $line[9] and not $line[10]. So, when you try to use $line[10], AutoIt complains... dim $line[10] $line[0] = FileReadLine($file) ; first element ;... $line[9] = FileReadLine($file) ; last element Edited April 24, 2007 by Helge Link to comment Share on other sites More sharing options...
thenewkid Posted April 24, 2007 Author Share Posted April 24, 2007 ok thanks Helge some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with 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