Scripting provides a flexible and easy way to automate tasks and extend the functionality of an application.
A script is a small program that enables you to customize and control your backup jobs. For example, you can write a script to copy, rename or delete a specific file, customize the user interface or change the profile settings. SyncBackPro’s scripting is like the macro support in Microsoft Office, JavaScript in web pages or plug-ins in other software.
You can use any simple text editor to create your scripts, e.g. Notepad. SyncBackPro 32-bit and 64-bit versions can use scripts written in the Basic or Pascal languages. However, VBScript can only be used with the 32-bit version of SyncBackPro (due to limitations in Windows). The Basic language script syntax is like VBScript and the Pascal language script syntax is similar to Delphi. When creating a script file, you need to use the .pas filename extension for Pascal, .bas for Basic and .vbs for 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);
begin
Result:='Description of the script goes here';
ScriptType:=SCRIPTTYPE_RUN + SCRIPTTYPE_CONFIG;
End;
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. Once you have created the script, save it with an appropriate filename and extension, e.g. .pas for Pascal scripts.
2. Next, you must install the script before using it. Go to the burger menu (on the top-left of SyncBackPro main window) > select Scripts. Click on the Install button and select 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.
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.
© 2003-2023 2BrightSparks Pte. Ltd. | Home | Support | Privacy | Terms | Affiliate Program