Programs Before

<< Click to Display Table of Contents >>

Navigation:  Using SyncBackPro > Expert Mode >

Programs Before

Previous pageReturn to chapter overviewNext page

 

Expert Mode: Programs Before Settings

 

Define what programs will run before and/or after the profile runs.

 

You have the option of running an external program before the profile starts and/or after the profile has finished. This useful option allows you to prepare the files being copied before the profile has run, for example. There are many possible uses for these settings in SyncBackPro, so read through the following and consider how they may be applied to your own computer setup.

 

Run before profile: To have a program run before the profile is run, enable the Run before profile checkbox and type the name into the edit-box or click the folder icon next to it. For example, you could type notepad.exe so whenever the profile starts Notepad will be run. You can use variables to define the program name, path, etc. See the section below for more details.

 

warning

Note that if the program name, or the folder it is in, contains spaces then you must wrap the entire program name with double-quotes otherwise the return value will always be 1. For example, C:\Program Files\Company Name\A Program.exe must be specified as "C:\Program Files\Company Name\A Program.exe". Any parameters passed to the program should also be wrapped in their own pair of double-quotes, especially if they contain spaces, e.g. "C:\Program Files\Company Name\A Program.exe" "param 1" "another param"

 

warning

Starting with Windows Vista, Microsoft introduced many restrictions on how programs can react to and handle the shutdown or restart of a computer. Due to these restrictions Run Before and Run After programs will silently fail and not even start if the profile is set to run on shutdown/logoff and the computer is shutdown or restarted (the programs will still be run as per normal if its a logoff).

 

Wait until the program has finished before running profile: If this option is enabled, then when the program is run, SyncBackPro will pause the profile until the program has finished. The program must exit/close before the profile will continue. If you do not enable this option then the program will be run and the profile will carry on running without waiting for it to finish.

 

Wait for a maximum of...: If this option is enabled, then you can choose how long SyncBackPro should wait for the program to finish before it continues. If the program does not finish within the specified time then SyncBackPro will continue with the profile. Note that it is advisable to set a maximum waiting time otherwise SyncBackPro may get "stuck" waiting for a program that is not going to exit.

 

oAbort the profile if the program fails to finish in time: If this option is ticked then if the program does not return in the time stated then the profile will stop.

 

Abort the profile if the program fails to execute: If enabled, and the before program fails to start (because the program doesn't exist or cannot be run), then the profile will not run. By default the profile will continue to run with a failure.

 

Abort the profile if the programs return value is not …: Most programs, batch files, and scripts, have a numeric return/exit value. This usually indicates if it ran without error, and if there was an error, what kind of error occurred. If you tick this checkbox then you can specify which return values the program must return for the profile to be run. A comma-delimited list of values can be entered, and a hyphen used to specify a range of values. For example, if the program returns 0, 1, or a value between 10 and 50 (inclusive) if it was run successfully, and any other value on failure, then in the edit box you would type 0, 1, 10-50.

 

o...but do not create a log or record it as a failure: If this option is ticked then if the program does not return the expected value then the profile will stop. No log will be created. An example is when you need to connect to something that may not always be available, and if it isn't available then it can be safely ignored, e.g. connecting to a network from a laptop.

 

Run the program when simulating: By default the program is not run when doing a simulated run. This is advisable as the program may change or delete files, which is not something you generally want to do during a simulated run.

 

Variables and switches

 

As with the Source/Left and Destination/Right directories, you can use Windows environment variables. For example, if you typed “Notepad %HOMEPATH%\test.txt” then this would run notepad and open a file in your home directory called test.txt. You can see a list of what typical Windows environment variables are available on the following web page:

 

http://windowsitpro.com/article/articleid/23873/what-environment-variables-are-available-in-windows.html

 

By default all external programs are run in a normal window and made the active window. You can have the program instead run minimized, for example, so that they do not appear as a window on the screen or become the active window. To do this prefix the program with one of the following:

 

/min This will run the program minimized and will not make it the currently active window. For example: /min "C:\Program Files\Company Name\A Program.exe"

 

/max This will run the program maximized. For example: /max "C:\Program Files\Company Name\A Program.exe"

 

/hide This will run the program minimized, hide the window and not make it the currently active window. For example: /hide "C:\Program Files\Company Name\A Program.exe"

 

/notact This will run the program and not make it the currently active window. For example: /notact "C:\Program Files\Company Name\A Program.exe"

 

Unlike the Source/Left and Destination/Right directories, you can also use special SyncBackPro variables. These are used in the same way as environment variables, except they have a leading underscore character, e.g. %_Source%. The value returned is for the profile being run. Below is a list of the most common variables that you can use:

 

_Compression = Returns 1 if the destination/right is compressed

 

_Destination = Destination/right directory/filename

 

_DestIsFTP = Returns Y if the destination/right is an FTP server

 

_Priority = Run priority of the profile

 

_SingleFile = Returns 1 if compressing to a single file (ignore if _Compression returns 0)

 

_Source = Source/left directory

 

For a full list see the profile settings INI file.

 

 

All Content: 2BrightSparks Pte Ltd © 2003-2017