VIP 55 Posted February 21, 2015 ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded. Global $INIFile = @ScriptDir & '\IniCheck.ini' Global $NumKEY = 5000 Global $randomDataLen = 10 FileDelete($INIFile) FileWriteLine($INIFile, '[Ciao]') For $i = 1 To $NumKEY FileWriteLine($INIFile, "Aloha[" & $i & ']=' & danRom($randomDataLen)) ;~ If (FileGetSize($INIFile) / 1024) >= 64 Then ;~ ExitLoop ;~ EndIf Next Local $i, $aArray = IniReadSection($INIFile, 'Ciao') ConsoleWrite('Section Read Test:' & $aArray[$NumKEY][0] & "=" & $aArray[$NumKEY][1] & @CRLF) ;~ For $i = 1 To $aArray[0][0] ;~ ConsoleWrite('Section Read Test:'& $aArray[$i][0] &"=" & $aArray[$i][1] &@CRLF) ;~ Next Func danRom($digits = 15) Local $pwd = "" Dim $aSpace[3] For $i = 1 To $digits $aSpace[0] = Chr(Random(65, 90, 1)) ;A-Z $aSpace[1] = Chr(Random(97, 122, 1)) ;a-z $aSpace[2] = Chr(Random(48, 57, 1)) ;0-9 $pwd &= $aSpace[Random(0, 2, 1)] Next Return $pwd EndFunc ;==>danRom What IniReadSection limit ? Regards, Share this post Link to post Share on other sites
Melba23 3,396 Posted February 21, 2015 Trong,Windows limits the size of any section to 32k - when I run your code I only get 1472 elements filled when I run IniReadSection. You will need to write your own function or change the whole script to read the data another way. >And your code to fill the ini file is horribly inefficient as you are opening and closing the file each time you write a line. It would be much better to do something like this: ; Start the data with the section name $sData = '[Ciao]' & @CRLF For $i = 1 To $NumKEY ; Add the lines one at a time $sData &= "Aloha[" & $i & ']=' & danRom($randomDataLen) & @CRLF Next Remove final @CRLF $sData = StringTrimRight($sData, 2) FileDelete($INIFile) ; And write the whole thing in one go FileWrite($INIFile, $sData)M23 1 VIP reacted to this Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Share this post Link to post Share on other sites
DXRW4E 20 Posted February 22, 2015 Ciao. 1 VIP reacted to this Share this post Link to post Share on other sites