The scripts tab is used to call a program, script, or email alert during a certain phase of a job run.
Pre Analyze
If the field is not empty, then take the action specified just before Analyze begins.
If the called program returns a non-zero return code or fails, do not start analyzing.
If the called program succeeds and returns a zero return code, proceed with the analysis.
Analyze no Sync
If the field isn't empty, take the action specified just after Analyze finishes.
NOTE: The action is taken only if Analyze finishes with no changes.
Post Sync
If the field isn't empty, take the action specified just after Sync finishes.
Sending Emails
If a "Scripts" field value contains the "@" symbol, GoodSync sends an email to the address(es) specified in the option.
Multiple email addresses must be separated by a comma or semicolon: user1@server.com; user2@hotmail.com
If only email addresses are specified in the field(s), a default email text is sent. To specify custom emails, you may prepend command(s) with some of the following options:
Example:
noattach: user@example.com: Synced %SYNCOK% items, changed items were %CHANGED%
Here "noattach" specifies that a sync log will not be attached to the email. The email will be sent to user@example.com and contain parameters %SYNCOK% (number of files/folders synced OK) and %CHANGED% (number of changed items synced OK).
Calling Programs
If a "Scripts" field value contains no "@", GoodSync runs the program specified in the option and arguments passed to this program:
program-name %ARG1% %ARG2% %ARG3% ...
where arguments can be one of the following (all variable names are case-sensitive):
%JOBNAME% | job name |
%RESULT% | Result: "" for OK or "terminal error message" |
%LOGPATH% | Log file path in "..." |
%LF% | Left folder path in "..." |
%LF_ACT% | Resolved (=VolumeName\folder -> f:\folder) Left folder path in "..." |
%RF% | Right folder path in "..." |
%RF_ACT% | Resolved (=VolumeName\folder -> f:\folder) Right folder path in "..." |
%CHANGED% | Number of changed Items in post-analyze |
%ERRORS% | Number of errors in post-analyze or post-sync |
%CONFLICTS% | Number of conflicts in post-analyze or post-sync |
%SYNCOK% | Number of synced-OK items in post-sync |
Please use absolute paths to point to the location of the program or script. If the program name contains spaces, it must be enclosed in double quotes like so:
"C:\Documents and Settings\John Smith\My Documents\myscript.vbs"
Example (call Notepad to show the log file):
notepad %LOGPATH%
If a script or email alert is prefixed with "errors:", it is started only if:
– Terminal errors occurred in analysis or sync, OR
– Non-Terminal errors occurred in analysis or sync, OR
– Conflicts occurred in the analysis.