I want to watch below actions for 2 predefined paths:
Code: Select all
; FILE_ACTION_ADDED = 1 (0x00000001) : The file was added to the directory.
; FILE_ACTION_REMOVED = 2 (0x00000002) : The file was removed from the directory.
; FILE_ACTION_MODIFIED = 3 (0x00000003) : The file was modified.
; FILE_ACTION_RENAMED = 4 (0x00000004) : The file was renamed (not defined by Microsoft).
Code: Select all
AutoHotkeySyncPath1 := "C:\Users\Cody\Desktop\New folder\Ahk"
AutoHotkeySyncPath2 := "C:\Users\Cody\Desktop\New folder\Ahk2"
AutoHotkeySyncTest() {
FolderSync(AutoHotkeySyncPath1, AutoHotkeySyncPath2)
}
FolderSync(Path1, Path2) {
Run, %ComSpec% /c robocopy "%Path1%" "%Path2%" /MIR",, Hide
}
WatchFolder(AutoHotkeySyncPath1, "AutoHotkeySyncTest", True, 1|2|3|4)
WatchFolder(AutoHotkeySyncPath2, "AutoHotkeySyncTest", True, 1|2|3|4)
Code: Select all
MyUserFunc(Folder, Changes) {
Static Actions := ["1 (added)", "2 (removed)", "3 (modified)", "4 (renamed)"]
TickCount := A_TickCount
GuiControl, -ReDraw, LV
For Each, Change In Changes
LV_Modify(LV_Add("", TickCount, Folder, Actions[Change.Action], Change.Name, Change.IsDir, Change.OldName, ""), "Vis")
Loop, % LV_GetCount("Columns")
LV_ModifyCol(A_Index, "AutoHdr")
GuiControl, +Redraw, LV
}
Any advice would be greatly appreciated, thanks!