ddeerr Posted May 29, 2006 Share Posted May 29, 2006 Hi all, Please help for this problem : see bellow my code is for listing and extracting computer names from a file which have 850 lines Arrive after 368 (i made test) it crash and said to me error. I don't know if it is a size limitation or something else, could you help plz ? ty C:\_DSA_\autoIt\mapRapide\mapGUI.au3 (228) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: Local $listLine, $listsplit, $listdatelock, $listpcname, $listlogin, $listcontext, $fileNbLines, $fileRef $fileNbLines = _FileCountLines("G:\Help_Desk\AutoIt\Login\listLogins-PCs.txt") $fileRef = FileOpen("G:\Help_Desk\AutoIt\Login\listLogins-PCs.txt", 0) If $fileRef <> -1 Then If StringLen(GUICtrlRead($loginInput4PC)) = 5 Then For $i = 1 To $fileNbLines Step 1 $listLine = FileReadLine($fileRef, $i) $listsplit = StringSplit($listline,";", 1) $listdatelock = $listsplit[2] $listpcname = $listsplit[3] $listlogin = $listsplit[4] ;$listcontext = $listsplit[5] If $listlogin = GUICtrlRead($loginInput4PC) Then GUICtrlSetData($ctrlInputComputer, StringUpper($listpcname)) ExitLoop ElseIf $listpcname = GUICtrlRead($loginInput4PC) Then GUICtrlSetData($listpcname, StringUpper($listdatelock)) ExitLoop EndIf Next Else MsgBox(0, "INFO", "5 car needed") GUICtrlSetData($loginInput4PC, "") EndIf FileClose($fileRef) Else MsgBox(0, "ERROR" , "try again") EndIf Link to comment Share on other sites More sharing options...
Rick Posted May 29, 2006 Share Posted May 29, 2006 (edited) is the last line empty?? if so For $i = 1 To $fileNbLines-1 Step 1 or $fileNbLines = _FileCountLines - 1 just a thought Edited May 29, 2006 by Rick Who needs puzzles when we have AutoIt!! Link to comment Share on other sites More sharing options...
ddeerr Posted May 29, 2006 Author Share Posted May 29, 2006 is the last line empty?? if so For $i = 1 To $fileNbLines-1 Step 1 just a thoughtnopi don't understand because it is a code that i got from a friend, and this code was working in his program.i'll put this code as a function in my code and in his one it was a simple if loop. Link to comment Share on other sites More sharing options...
Rick Posted May 29, 2006 Share Posted May 29, 2006 (edited) debug it with MsgBox(0,"",$listsplit [0] & @cr & $listsplit [1]) ;etc it may come apparent then as one of the lines dont contain 4 or 5 splits Edited May 29, 2006 by Rick Who needs puzzles when we have AutoIt!! Link to comment Share on other sites More sharing options...
ddeerr Posted May 29, 2006 Author Share Posted May 29, 2006 debug it with MsgBox(0,"",$listsplit [0] & @cr & $listsplit [1]) ;etc it may come apparent then as one of the lines dont contain 4 or 5 splits the split return 9 splits but i juste need 3 of them. The file used is created by my program and i tried to filter just the 3 parameters i need at it creation but the same problem appeared Link to comment Share on other sites More sharing options...
ddeerr Posted May 29, 2006 Author Share Posted May 29, 2006 the problem appeared at the 368 line checked by my program after this one it is ok Link to comment Share on other sites More sharing options...
Rick Posted May 29, 2006 Share Posted May 29, 2006 is it possible you can attach the file for me to test your script? Who needs puzzles when we have AutoIt!! Link to comment Share on other sites More sharing options...
ddeerr Posted May 29, 2006 Author Share Posted May 29, 2006 is it possible you can attach the file for me to test your script?i would like but i don't now a site were i can do that could you help me for that too (yes i'm noob ) Link to comment Share on other sites More sharing options...
Rick Posted May 29, 2006 Share Posted May 29, 2006 i would like but i don't now a site were i can do that could you help me for that too (yes i'm noob ) you attach it to a message, like this one Who needs puzzles when we have AutoIt!! Link to comment Share on other sites More sharing options...
randallc Posted May 29, 2006 Share Posted May 29, 2006 you attach it to a message, like this oneLower on the screen, when you are writing your reply, find "File Attachments", click "browse" button, find the directory and file, then "Add this attachment" button, then wait, and "Add Reply" buttonBest, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
ddeerr Posted May 30, 2006 Author Share Posted May 30, 2006 Lower on the screen, when you are writing your reply, find "File Attachments", click "browse" button, find the directory and file, then "Add this attachment" button, then wait, and "Add Reply" buttonBest, RandallTyHere it is listLogins_PCs.txt Link to comment Share on other sites More sharing options...
GioVit Posted May 30, 2006 Share Posted May 30, 2006 The problems is that the information in Line 369 of your data is "Different" so you have to check the number of strings returned by StringSplit function: expandcollapse popupLocal $listLine, $listsplit, $listdatelock, $listpcname, $listlogin, $listcontext, $fileNbLines, $fileRef ;$fileNbLines = _FileCountLines("G:\Help_Desk\AutoIt\Login\listLogins-PCs.txt") $fileNbLines = _FileCountLines("listLogins-PCs.txt") ;$fileRef = FileOpen("G:\Help_Desk\AutoIt\Login\listLogins-PCs.txt", 0) $fileRef = FileOpen("listLogins-PCs.txt", 0) If $fileRef <> -1 Then If StringLen(GUICtrlRead($loginInput4PC)) = 5 Then For $i = 1 To $fileNbLines Step 1 $listLine = FileReadLine($fileRef, $i) $listsplit = StringSplit($listline,";", 1) ;Check Here If $listsplit[0] >= 5 Then $listdatelock = $listsplit[2] $listpcname = $listsplit[3] $listlogin = $listsplit[4] ;$listcontext = $listsplit[5] If $listlogin = GUICtrlRead($loginInput4PC) Then GUICtrlSetData($ctrlInputComputer, StringUpper($listpcname)) ExitLoop ElseIf $listpcname = GUICtrlRead($loginInput4PC) Then GUICtrlSetData($listpcname, StringUpper($listdatelock)) ExitLoop EndIf Else ;you may comment or delete this line MsgBox(48, "Warning", "Line " & $i & " skipped",1) EndIf Next Else MsgBox(0, "INFO", "5 car needed") GUICtrlSetData($loginInput4PC, "") EndIf FileClose($fileRef) Else MsgBox(0, "ERROR" , "try again") EndIf Link to comment Share on other sites More sharing options...
ddeerr Posted May 30, 2006 Author Share Posted May 30, 2006 The problems is that the information in Line 369 of your data is "Different" so you have to check the number of strings returned by StringSplit function:It is crazy i wasn't see it !!!!!!!!! :\Thanks a lot 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