sift:directory_watchers
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
sift:directory_watchers [2025/02/06 16:02] – sgranger | sift:directory_watchers [2025/02/06 16:49] (current) – sgranger | ||
---|---|---|---|
Line 5: | Line 5: | ||
Watchers are stored as a XML file within you PCs AppData folder, it is possible to create, remove, and edit these files directly as long as the formatting is maintained. This can even be done through external scripting tools allowing you to even automate the process of creating and editing watchers. | Watchers are stored as a XML file within you PCs AppData folder, it is possible to create, remove, and edit these files directly as long as the formatting is maintained. This can even be done through external scripting tools allowing you to even automate the process of creating and editing watchers. | ||
- | " | + | " |
- | [pic] | + | {{sift_watcher_xml.png}} \\ |
- | the AppData folder is hidden by default on most windows systems | + | the AppData folder is hidden by default on most windows systems file explorer can be set to show hidden files by accessing **View** |
- | + | {{windows_hidden_items.png}} \\ | |
- | [pic] | + | |
===== Creating, Editing, and Deleting Watchers ===== | ===== Creating, Editing, and Deleting Watchers ===== | ||
- | In addition to interacting with the files directly Watchers controlled through the following commands on the Sift command line: | + | In addition to interacting with the files directly, Watchers |
---- | ---- | ||
==== -CreateWatcher / -cw ==== | ==== -CreateWatcher / -cw ==== | ||
---- | ---- | ||
+ | Create a new Directory Watcher, the file will automatically be saved to the AppData watcher folder, by default all new watchers a set to active. | ||
=== Parameters === | === Parameters === | ||
== Name (Required) == | == Name (Required) == | ||
Line 25: | Line 25: | ||
This is the directory that will be watched, this can be passed more than once to watch multiple directories \\ | This is the directory that will be watched, this can be passed more than once to watch multiple directories \\ | ||
== Script (Required) == | == Script (Required) == | ||
- | This is a script to be executed upon triggering the watcher, the script can be a .v3s pipeline or a .bat script in the case of a .bat script the first line of the script must be ##SIFT (This ensures only scripts fully intended for sift are executed), the script command can be passed multiple times to execute multiple scripts, the scripts will be executed in the order they are passed. \\ | + | This is a script to be executed upon triggering the watcher, the script can be a .v3s pipeline or a .bat script in the case of a .bat script the first line of the script must be ::SIFT (This ensures only scripts fully intended for sift are executed), the script command can be passed multiple times to execute multiple scripts, the scripts will be executed in the order they are passed. \\ |
== Recursive == | == Recursive == | ||
If this is passed all sub-directories within a watched directory will also be watched. \\ | If this is passed all sub-directories within a watched directory will also be watched. \\ | ||
== Delay == | == Delay == | ||
- | The time in milliseconds between a trigger and the execution of the script(s). A delay is important, as if you were to move several file into a watched directory at once, a trigger would be made for each file. The delay will be reset with each new file, ensuring that everything is only triggered once. Alternatively you could set a large delay if you want things to run a certain time after you're done working. \\ | + | The time in milliseconds between a trigger and the execution of the script(s). A delay is important, as if you were to move several file into or out of a watched directory at once, a trigger would be made for each file. The delay will be reset with each new file, ensuring that everything is only triggered once. Alternatively you could set a large delay if you want things to run a certain time after you're done working, or if you do want the watcher to trigger for each individual event, set delay to 0\\ |
< | < | ||
== Overwrite == | == Overwrite == | ||
If passed this watcher will overwrite any existing watchers with the same name, otherwise the command will fail \\ | If passed this watcher will overwrite any existing watchers with the same name, otherwise the command will fail \\ | ||
+ | === Example === | ||
+ | < | ||
- | -listwatchers | + | ---- |
+ | ==== -listwatchers | ||
+ | ---- | ||
This command will list all watchers and their parameters | This command will list all watchers and their parameters | ||
- | -deleteWatcher | + | ---- |
- | use this command and pass the name of a watcher to delete it. | + | ==== -deleteWatcher |
- | ==Using | + | ---- |
- | For watchers to work Sift must be running in the background, from the system tray, to launch Sift in background mode you can either pass the command -LaunchMinimized, | + | Use this command and pass the name of a watcher to delete it. |
+ | === Parameters === | ||
+ | == name (Required) == | ||
+ | The name of the watcher to delete | ||
+ | === Example === | ||
+ | < | ||
+ | |||
+ | ---- | ||
+ | ==== -ActivateWatcher / -aw ==== | ||
+ | ---- | ||
+ | Used to activate the passed watcher(s) | ||
+ | === Parameters === | ||
+ | == name == | ||
+ | The name of the watcher to be activated can be passed multiple times to activate multiple watchers, if no name is passed all watchers will be activated \\ | ||
+ | === Example === | ||
+ | < | ||
+ | |||
+ | ---- | ||
+ | ==== -DeactivateWatcher / -daw ==== | ||
+ | ---- | ||
+ | Used to deactivate the passed watcher(s) | ||
+ | === Parameters === | ||
+ | == name == | ||
+ | The name of the watcher to be deactivated, | ||
+ | === Example === | ||
+ | < | ||
+ | |||
+ | |||
+ | |||
+ | ===== Using Watchers ===== | ||
+ | For watchers to work Sift must be running in the background, from the system tray, to launch Sift in background mode you can either pass the command -LaunchMinimized, | ||
once sift is running in the background you can interact with it via the system tray icon | once sift is running in the background you can interact with it via the system tray icon | ||
- | from here you can | + | {{sift_tray.png}} \\ |
+ | from here you can \\ | ||
+ | * **Open GUI** - this will open a standard instance of sift with a GUI | ||
+ | * **Open Console** - this will open a console instance of sift, only one console instance of sift can run at a time | ||
+ | * **Quit** - this will close the background instance of sift, all other instances will remain open | ||
+ | * **Disable Start in Tray** - If you have sift set to launch in the background by default, this will disable it | ||
+ | * **Watchers** - if you have any active watchers they will be found here, within this list you can enable or disable individual watchers or enable or disable all watchers | ||
+ | {{sift_tray_watchers.png}} \\ | ||
+ | |||
+ | when a watcher is triggered all v3d pipelines will be run in the background, however all .bat scripts will open a command line interface, if you are running sift commands a command line instance of sift will open, this will not work if you already have sift open on the console, or if a script is triggered while another is still be processed. | ||
+ | |||
+ | ==== BATCH Files ==== | ||
+ | Any .bat file can be executed via Directory Watchers, as long as the first line of the file is a BATCH comment containing SIFT (::SIFT) in order to run Sift commands via directory watchers you must first call Sift and pass it the desired commands | ||
- | open gui - this will open a standard instance of sift with a GUI | + | === Example === |
- | open console - this will open a console instance of sift, only one console instance of sift can run at a time | + | < |
- | quit - this will close the background instance of sift, all other instances will remain open | + | ::SIFT |
- | Disable start in tray - If you have sift set to launch in the background by default, this will disable it | + | |
- | Watchers - if you have any active watchers they will be found here, within this list you can enable or disable individual watchers or enable or disable all watchers | + | |
- | when a watcher is triggered all v3d pipelines will be run in the background, however all .bat scripts will open a commandline interface, if you are running sift commands a command line instance of sift will open, this will not work if you already have sift open on the console, or if a script is triggered while another is still be processed. | + | " |
+ | </ | ||
- | [batch example] | + | Windows BATCH scripting is a powerful tool and much more logic can be put into them, see the [[sift: |
sift/directory_watchers.1738857767.txt.gz · Last modified: 2025/02/06 16:02 by sgranger