<< Click to Display Table of Contents >>

Navigation:  Using SyncBackPro > Technical Reference > Scripting >


Previous pageReturn to chapter overviewNext page


These are functions that should be defined in all scripts regardless of their type. All scripts must implement the Description function, but the others are optional. The functions are called by SyncBackPro at the appropriate time.


All the example code below is written in using the Pascal scripting language.


function Description(var ScriptType);


ScriptType: Set this to the type of script


Return value: A short description of the script (this is shown to the user)


This function is mandatory. All scripts must declare this function.


Called to get a description of the script and what type of script it is. The description is not stored and so can be dynamic, however this should not be relied upon in future. The description is stripped of newline and carriage return characters.


The script type is an integer that defines when the script should be used by SyncBack. It is a bitmask (i.e. the values can be or'ed together) of the following types:


SCRIPTTYPE_NONE = Not a valid script

SCRIPTTYPE_CONFIG = A script that can be used when configuring profiles (a 'configuration' script)

SCRIPTTYPE_RUN = A script that can be used by profiles at run-time (a 'run-time' script)

SCRIPTTYPE_MAIN = A script that can be used by in the main user interface (a 'main' script)

SCRIPTTYPE_LOCATION = A script that can be used by profiles to store and retrieve files (a 'location' script)


A single script file can be used in more than one place. For example, if a script was both a location and a run-time script then its ScriptType value would be SCRIPTTYPE_LOCATION + SCRIPTTYPE_RUN. The script type is stored by SyncBack when the script is installed.


function Description(var ScriptType);


  Result:='A short description of what this script does';





function FilesToExport(Interactive, Counter);


Interactive: Passed as True if the script can prompt the user

Counter: This is initially passed as 0 (zero) and incremented on each call


Return value: The complete filename of a file to be exported along with the script


Called when a script is being exported as part of a profile. This function is called repeatedly until an empty string is returned. For the first call the Counter value is zero, and is incremented on each call.


The script should return the filenames (one per call) of files that SyncBack should include into the exported profile (the .SPS file). The filenames must be complete filenames including the drive and path. Note that when the script is imported, the files (and the script) will all be put into their own unique folder and then the Install function will be called (the script can then move those files, if required, and do any other installation tasks, e.g. register COM objects).


Do not include the filename of the script itself as that is included automatically. This function does not need to be defined if the script has no accompanying files.


If Interactive is True then the script can prompt for user input, otherwise it must not ask for user input (e.g. dialogs boxes should not be displayed).


function FilesToExport(Interactive, Counter);


  if (Counter = 0) then


  else if (Counter = 1) then








function Install(Interactive);


Interactive: Passed as True if the script can prompt the user


Return value: An error message on failure


Called when the script is installed into SyncBack. On failure it should return an error message, in which case the script will not be installed.


This function is called when a script is installed, either by the user via the Script window, or via the import of a profile that uses scripts. It can be used, for example, to move files used by the script to their correct places or to register COM objects. Note that if a script is already installed then Install is not called.


You should not prompt the user, or expect user input, if Interactive is passed as FALSE.


function Install(Interactive);


  if Interactive then





procedure Uninstall();


This function is called when the script is uninstalled from SyncBack. It should assume no user is present, i.e. it should not prompt the user for input.


procedure Uninstall;









All Content: 2BrightSparks Pte Ltd © 2003-2021