# WatchDirectory()

作者: HotKeyIt, SKAN, Lexikos 最近更新时间: 20090613

- You can add a new folder to watch for.
- Report changes to any function
- Stop watching

WatchDirectory("C:\Windows",1)

关于函数的参数和返回值, 请参阅其源码.

#### 备注

This functionality already exist in Crazy Scripting : FolderSpy v0.96 Synchronous (http://www.autohotkey.com/forum/viewtopic.php?t=22862).
Requires at least Windows 2000 or higher.
It is not strictly standard conform, because it a awaits a user defined function.
Also this lacks an external documentation. Look for that at head of source.

关于此函数(集)的更新细节和注意事项, 请参见 AutoHotkey 论坛: http://www.autohotkey.com/forum/viewtopic.php?t=45237

#### 许可

不存在

#### 示例

    ; #Include WatchDirectory.ahk
    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%
    #Persistent

    OnExit,Exit
    WatchDirectory("C:\Windows",1)
    SetTimer,WatchFolder,100
    Return

    WatchFolder:
        WatchDirectory("RegisterChanges")
    Return

    RegisterChanges(action,folder,file){
        static
        #1:="New File", #2:="Deleted", #3:="Modified", #4:="Renamed From", #5:="Renamed To"
        ToolTip % #%Action% "`n" folder . (SubStr(folder,0)="\" ? "" : "\") . file
    }

    Exit:
        WatchDirectory()
    ExitApp