Decker87 Posted August 4, 2008 Posted August 4, 2008 (edited) Func _DirFileInfo($sBaseDir, ByRef $aMain) ;$aMain[File Number][0 = File Path, 1 = File Size] Dim $temp6[3] $temp6[0]=0 $temp6[1]=1 $temp6[2]=2 $temp6 = DirGetSize($sBaseDir, 1) $iCount = $temp6[1] + $temp6[2] Local $hSearch = FileFindFirstFile($sBaseDir & "\*") Local $sFilePath, $iUBound = UBound($aMain, 1) For $i = 1 To $iCount $sFilePath = FileFindNextFile($hSearch) If StringInStr(FileGetAttrib($sBaseDir & "\" & $sFilePath), "D") == 0 Then; It's a file! ReDim $aMain[$iUBound+1][2] $aMain[$iUBound][0] = $sFilePath $aMain[$iUBound][1] = FileGetSize($sFilePath) Else;It's a folder! _DirFileInfo($sFilePath, $aMain) EndIf Next EndFunc Local $array[1][1] _DirFileInfo("C:\Install Files", $array) _ArrayDisplay($array) Why in the world am I getting a "subscript used with non-array variable" error here? Why is it that _ArrayDisplay can display temp6 as an array, but AutoIT does not recognize it as an array? I am thoroughly confused. Shouldn't DirGetSize return an array? Edited August 4, 2008 by Decker87
Achilles Posted August 4, 2008 Posted August 4, 2008 Your $count variable is 3 ($temp6[1] + $temp6[2])... There is no $temp6[3], it's out of the array bounds. your array only has $temp6[0], $temp6[1], $temp6[2]... 3 items. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
rasim Posted August 4, 2008 Posted August 4, 2008 Decker87 said: Why in the world am I getting a "subscript used with non-array variable" error here? Why is it that _ArrayDisplay can display temp6 as an array, but AutoIT does not recognize it as an array? I am thoroughly confused. Shouldn't DirGetSize return an array?Try to check DirGetSize function return value: $temp6 = DirGetSize($sBaseDir, 1) If @error Then Return SetError(1, 0, 0)
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