-
Notifications
You must be signed in to change notification settings - Fork 71
/
CompareFileNameArray.ahk
57 lines (40 loc) · 1.05 KB
/
CompareFileNameArray.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
CompareFileNameArray()
{
; compares each file to the array and determines if a newer version exists
; MsgBox params: %params%
; declare local, global, static variables
Global
Try
{
; set default return value
NewerVersionExists := 0
; validate parameters
; initialise variables
; campare the array
Loop, %FileNameArray0%
{
IfNotExist, % FileNameArray%A_Index% ; if the filename stored in the array doesn't exist
Continue
FileGetTime, FileModifyStampCheck, % FileNameArray%A_Index%, M ; get 'Date Modified' of the file
If (FileNameArrayModTime%A_Index% < FileModifyStampCheck) ; if stored mod time is earlier than actual mod time
{
NewerVersionExists := 1
Break
}
}
}
Catch, ThrownValue
{
CatchHandler(A_ThisFunc,ThrownValue.Message,ThrownValue.What,ThrownValue.Extra,ThrownValue.File,ThrownValue.Line,0,0,0)
}
Finally
{
}
; return
Return NewerVersionExists
}
/* ; testing
params := xxx
ReturnValue := CompareFileNameArray(params)
MsgBox, CompareFileNameArray`n`nReturnValue: %ReturnValue%
*/