Page tree
Skip to end of metadata
Go to start of metadata

Introduced in




Specifies which files should trigger a FileChanged event. If wildcards are used, then only the files that exist at the execution of the command are considered. Other files that are added later (even though they might match the filter), are ignored.

Multiple watches can be created, with the later ones being added to the list (rather than replacing the existing one).


Syntax:fileWatch filter
  • filter: String - File name, or full path to file to watch. Typical windows wildcards (* or ?) can be used on the file name (but not the path). If no path is specified, then the installation folder is used.
Return Value:Nothing


// create global fileChanged event handler
addGlobalEventHandler ["FileChanged", "systemChat format['fileChanged: %1',_this]"]; 

// specify which file to watch
fileWatch "d:\bi\tst.txt"; 
// watch any .log files in the installation folder
fileWatch "*.log"; 

Additional Information

See also: fileUnwatch, FileChanged
Problems:File that are watched cannot be deleted (or moved, or renamed). In V3.x, this lock is released once the file is fileUnwatch, but in V2.x even that does not help, and VBS may have to be restarted to release a locked file.