-
Notifications
You must be signed in to change notification settings - Fork 71
/
CreateFileNameArray.ahk
59 lines (45 loc) · 1.27 KB
/
CreateFileNameArray.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
CreateFileNameArray(ByRef fnFileNameArrayMaxTime := "19000101000000")
{
; creates a global array holding names of files in script directory
; MsgBox fnFileNameArrayMaxTime: %fnFileNameArrayMaxTime%
; declare local, global, static variables
Global
Local temp
Try
{
; set default return value
ReturnValue := 0 ; success
; validate parameters
; initialise variables
FileNameArray0 := 0
; create array
Loop, Files, %A_ScriptDir%\*.*, F
{
If A_LoopFileExt not in ahk,ini
Continue
FileNameArray0++
FileNameArray%FileNameArray0% := A_LoopFileFullPath
FileGetTime, temp, %A_LoopFileFullPath%, M
FileNameArrayModTime%FileNameArray0% := temp
FileNameArrayExt%FileNameArray0% := A_LoopFileExt
If A_LoopFileExt in ini,lnk
Continue
fnFileNameArrayMaxTime := FileNameArrayModTime%FileNameArray0% > fnFileNameArrayMaxTime ? FileNameArrayModTime%FileNameArray0% : fnFileNameArrayMaxTime
}
}
Catch, ThrownValue
{
ReturnValue := !ReturnValue
CatchHandler(A_ThisFunc,ThrownValue.Message,ThrownValue.What,ThrownValue.Extra,ThrownValue.File,ThrownValue.Line,0,0,0)
}
Finally
{
}
; return
Return ReturnValue
}
/* ; testing
params := xxx
ReturnValue := CreateFileNameArray(params)
MsgBox, CreateFileNameArray`n`nReturnValue: %ReturnValue%
*/