Scripting provides a flexible and easy way to automate tasks and extend the functionality of an application.
With SyncBackPro V11, you can use the built-in script editor to create and edit your scripts. SyncBackPro can use scripts written in the Basic or Pascal script languages. The Basic script language syntax is like VBScript and the Pascal script language syntax is similar to Delphi. When creating a script file, you need to use the .pas filename extension for Pascal and .bas for Basic.
Although, for backwards compatibility reasons, SyncBackPro 32-bit supports VBScript (.vbs), we do not recommend using it. You cannot use the built-in script editor or debugger with VBScript.
Scripting is only supported in SyncBackPro. It is not available in SyncBackSE and SyncBackFree.
There are four different types of scripts:
A single script file can use more than one type of script. For example, you could write a script that is both a Profile configuration and Runtime script. SyncBackPro knows what type of script is being used from the Description function inside the script.
For example: the following is a profile configuration and runtime Pascal script:
Function Description(var ScriptType);
Result:='Description of the script goes here';
ScriptType:=SCRIPTTYPE_RUN + SCRIPTTYPE_CONFIG;
SyncBackPro provides helper objects (e.g. SBSystem) for the scripts to easily communicate with the program. Based on the script type, one or more of the following helper objects will be available to the script:
The SyncBackPro Help File explains in detail all of the objects, functions and constants available to scripts.
1. First, you write a script that contains functions. The function will perform tasks when certain events occur. To do this: Go to the burger menu (on the top-left of SyncBackPro main window) > select Scripts and click the New button. By default a Pascal script is created.
2. When you create a new script, you can import (install) it once it is saved (you will be prompted). Alternatively, you can install an existing script by going to the burger menu (on the top-left of SyncBackPro main window) > select Scripts, clicking on the Install button and then selecting the script you would like to use.
You can also install (or import) a script via the command line interface by simply passing the filename of the script, but the extension must be .SBS, i.e. it must have been exported previously from SyncBackPro (see below).
e.g. "C:\Program Files\2BrightSparks\SyncBackPro\SyncBackPro.exe" "C:\Scripts\AllDrives.sbs"
If you want to import multiple scripts using wildcards, then you can use the -importscript command line parameter.
e.g. "C:\Program Files\2BrightSparks\SyncBackPro\SyncBackPro.exe" -importscript "C:\Scripts\*.sbs"
For security reasons scripts are always imported interactively and with the users consent.
3. After installing a script you should compile it to check for errors. Select the script from Scripts page and click on the Edit button. The Script Editor Window will appear. Click on the Compile button, or right click on the script and choose Compile from the pop-up menu to compile the script. You can also edit the script and save the changes using Apply option on the Script Editor.
4. You then need to activate the script. If it's a Main Interface or Profile Configuration script, you can immediately activate it after installation. Simply click on the Yes button when prompted.
Alternatively, go to the relevant tab on the Scripts page and tick the checkbox next to the script to activate it.
To use a Runtime script, modify your profile > go to the Scripts page and tick the check box next to the script. For Location script, you must create a profile with that script, so that the backup or restore is done using that script.
5. When SyncBackPro performs an action, it will check to see if there are any installed scripts that can be called for that event. For example, you have installed a main interface script that adds a new column to display the duration of a profile run. Whenever SyncBackPro refreshes the main window, it checks to see if there are any main interface scripts installed that can be called. If so, it calls the appropriate function in the script to perform the task.
To export a script, go to the burger menu > Scripts page > select the script and click on Export button. The exported script file is saved with the .SBS extension.
SyncBackPro V11 introduced the ability to debug scripts both at runtime and while editing a script. See the help file for more details.
With Scripting, you can easily automate repeated tasks and control your backup operations. You can also save time by automating complex processes using scripts. The SyncBackPro installation folder includes example scripts and there are more listed on our Scripting page, so you can find a script that performs the task you want and modify it to suit your needs.