Wednesday, March 21, 2012

Watch 4 Folder 2.3

W4F is a utility is kind of a wrapper to Microsoft Windows ShellNotify API, and it can alert and execute different actions based on the rules the user set and the events triggered by the ShellNotify.
When W4F starts, it will initialize some variables that will contain different user input parameters, and check if it was executed with any command line parameters.
If the command line parameters exist, W4F will check if they are valid parameters, if not, it will show a warning message and just load with no parameters.
If the parameters are valid, W4F will open the monitoring ini file passed from the command line parameters and will populate the different monitoring rules and other form fields according to the data loaded from the ini file.
If the command line parameters indicate auto start monitoring, W4F will auto start the monitor, if command line parameters indicate to start minimized, the form will auto minimized itself to the system tray.
In case there are no command line parameters, the monitor form will show cleared without any predefined settings.
A click on "Load" will launch the Windows open file dialog, filtered to *.ini files, selecting a settings ini file will start a short check to validate the format and content of the ini file, if the file is not compatible, a popup message will warn the user, if the ini file is OK, the settings from this file will be loaded into the different monitoring settings fields.
A click on "Save" will take the current settings from the monitor form and will save them to a new ini file named as the user input in the save dialog.
The user can enter the monitoring settings manually directly into the form, the results will be the same.
When the user click on "Start Monitoring", W4F will collect the different user inputs (target folder, watch for sub folders, events to monitor, actions, etc.) and will add them as properties to the monitoring object, and will validate that they are legal settings and if all mandatory parameters exist and they are legal (for example the existence of a target folder).
If something is missing a warning message will popup, if everything is legal, the monitor will start by warping the ShellNotify API and listening to changes according to the events filter created by the user and the "Start Monitoring" button caption will change to "Stop Monitoring".
In case an event was trigger, the ShellNotify will update W4F and it will check the monitoring object for selected actions and will execute the appropriate action based on the user selection (write to log, execute a program, etc.).
Every change in the settings and every event triggered will add a line to the live log tab, even if no action was selected.
W4F executable is fully portable, you can copy it to a USB device or a different computer and it will run with no installation.
The file is also compressed with UPX to achieve a small size.

1 comment: