Jump to content

FileGetTime with 2 Dimensional array?


Recommended Posts

I want to fill a 2 dimensional array with the array get from FileGetTime(with Format=array)

i've declared a 2 dimensional array

Dim $JobTimeArray[4][6] ;FilegetTime gives a 6 element array

Do
If FileExists(@WindowsDir&"\Tasks\"& $JobName & $AS_array[$t] & ".job")=1 Then
 $JobTimeArray[$Nsch]=FileGetTime(@WindowsDir&"\Tasks\"& $JobName & $AS_array[$t] & ".job",0,0)
 $Nsch=$Nsch+1
EndIf 
$t=$t+1
Until $t=4

Compilation keeps giving:

Array variable has incorrect number of subscripts or subscript dimension range exceeded

Also tried to use _AddArray but this probably only works with 1-dimensional arrays.

What am i doing wrong?

Link to comment
Share on other sites

  • Moderators

Your only trying to get 1 element of the array... [$Nsch][Where/what is this element?]

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I want to fill a 2 dimensional array with the array get from FileGetTime(with Format=array)

i've declared a 2 dimensional array

Dim $JobTimeArray[4][6] ;FilegetTime gives a 6 element array

Do
If FileExists(@WindowsDir&"\Tasks\"& $JobName & $AS_array[$t] & ".job")=1 Then
 $JobTimeArray[$Nsch]=FileGetTime(@WindowsDir&"\Tasks\"& $JobName & $AS_array[$t] & ".job",0,0)
 $Nsch=$Nsch+1
EndIf 
$t=$t+1
Until $t=4

Compilation keeps giving:

Array variable has incorrect number of subscripts or subscript dimension range exceeded

Also tried to use _AddArray but this probably only works with 1-dimensional arrays.

What am i doing wrong?

FileGetTime(), with your options, returns a 1D array, which you are trying to save to a 2D array:

$FileTimeArray=FileGetTime(@WindowsDir&"\Tasks\"& $JobName & $AS_array[$t] & ".job",0,0)
For $n = 0 To 5
     $JobTimeArray[$Nsch][$n] = $FileTimeArray[$n]
Next

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...