|
DirMonitor now fully supports Scripts. However, I still don't have many procedures to be used in these Scripts. If there is enough interest from the users, I will continue developing these Scripts.
If you have an idea for a procedure to be included in these Scripts, please let me know.
Creating Scripts
DirMonitor will enable you to create Scripts in an syntax colored editor. In the menu called Scripts, choose Script Editor.

A Script Editor will popup.

As an example, you can open the file called SampleScript.dms in the subfolder called Scripts. This file contains an example Script. You can review it to get an idea of the syntax used in this Scripting language.

Syntax
From the screenshot you can extract much information about the syntax of this Scripting language.
Here I will summarize it again:
[procedure] {
[parameter] [value]
}
That's all!
Keep in mind that the "{" needs to begin on the same line as the name of the procedure.
As an example, I will discuss the following procedure:
AddFolderWatch {
path "C:\Windows\System32"
recursive false
watch [create,modify]
notify true
AddTrigger {
path "C:\WINDOWS\system32\notepad.exe"
params "%modify%"
trigger [modify]
}
AddFilter {
filter "*.txt"
kind include
}
AddFilter {
filter "*.*"
kind exclude
}
}
This simple Script will create a Watch on the Folder C:\Windows\System32. Additionally, it will attach a Trigger to this Watch which will be activated when a file is being modified.
The Watch will only log *.txt files as I've created a Filter for this Watch. Also the Watch will only log creation and modification of files in that Folder.
In this example you see that there can be multiple so-called nested procedures in another procedure. This nesting can only occur in a limited number of procedures, of which AddFolderWatch is one.
A nested procedure will act on items created in the previous procedure. In this case, a Trigger and two Filters will be attached to the previously created Watch.
Remarks
- Sets need to be placed between brackets [].
- Strings have to start and end with "".
- The order in which the parameters occur in a procedure isn't important.
- Nested procedures have to be the last parameters you include in a procedure.
Overview
Here I will give an overview of the procedures you can use in a Script.
You can even create your own procedures and use them in your Scripts. This feature will be discussed in the Chapter TPPS.
These are the "fixed" procedures, which are included in the main program.
|
Procedure/Params
|
Kind
|
Description
|
| AddFolderWatch |
|
Create a new Folder Watch. |
| path |
string |
Path of Folder to monitor. |
| recursive |
bool |
(true/false) Set recursive or not. |
| notify |
bool |
(true/false) Notify when changes occur. |
| watch |
set |
(create, delete, modify, activate or terminate) Which activities to log. |
| AddTrigger |
|
Attach a Trigger to this Watch. |
| AddFilter |
|
Attach a Filter to this Watch. |
| |
| AddRegistryWatch |
|
Create a new Registry Watch. |
| path |
string |
Path of Registry Key to monitor. |
| notify |
bool |
(true/false) Notify when changes occur. |
| watch |
set |
(create, delete, modify, activate or terminate) Which activities to log. |
| AddTrigger |
|
Attach a Trigger to this Watch. |
| AddFilter |
|
Attach a Filter to this Watch. |
| |
| AddTrigger |
|
Attach a Trigger to a Watch (only as nested proc). |
| path |
string |
File to launch when the Trigger is activated. |
| params |
string |
Params to pass to that file (can be dynamic). |
| trigger |
set |
When to activate the Trigger. |
| AddFilter |
|
Attach a Filter to a Watch (only as nested proc). |
| filter |
string |
File extension to filter. |
| kind |
include/exclude |
Whether to include/exclude that extension. |
| |
| RemoveWatch |
|
Remove a Watch from the list. |
| index |
int |
Index of Watch to remove. |
| RemoveTrigger |
|
Remove a Trigger from the current Watch. (only as nested proc). |
| index |
int |
Index of Trigger to remove. |
| RemoveFilter |
|
Remove a Filter from the current Watch. (only as nested proc). |
| index |
int |
Index of Filter to remove. |
| |
| EditWatch |
|
Edit a Watch. |
| path |
string |
Path of item to monitor. |
| recursive |
bool |
Set recursive or not. |
| notify |
bool |
Notify when changes occur. |
| watch |
set |
Which activities to log. |
| AddTrigger |
|
Attach a Trigger to this Watch. |
| AddFilter |
|
Attach a Filter to this Watch. |
| RemoveTrigger |
|
Remove a Trigger from this Watch. |
| RemoveFilter |
|
Remove a Filter from this Watch. |
| |
| Plugin |
|
Plugin manipulation. |
| run |
string |
Name of plugin to execute (filename!). |
| |
And here are some of the extra procedures, developed using TPPS.
I've included the name of the plugin with each procedure (before the ::). You don't need to include that in your Scripts.
|
Procedure/Params
|
Kind
|
Description
|
| FileFunc::Execute |
|
Open a file. |
| path |
string |
Path of file to open. |
| params |
string |
Parameters to pass to that file. |
| state |
set |
(max, min or normal) State in which the file will open. |
| |
| MsgFunc::ShowMessage |
|
Show a Message Dialog. |
| caption |
string |
Caption of that Dialog. |
| text |
string |
Text in the Dialog. |
| type |
set |
(info, warning or question) Which kind of icon. |
| MsgFunc::ShowMsg |
|
See MsgFunc::ShowMessage. |
| MsgFunc::Dialog |
|
See MsgFunc::ShowMessage. |
| MsgFunc::MessageBox |
|
See MsgFunc::ShowMessage. |
| |
Click on one of the chapters to the left of this screen.
|