SBHistory

<< Click to Display Table of Contents >>

Navigation:  Using SyncBackPro > Technical Reference > Scripting >

SBHistory

 

These are functions that can be accessed from scripts via the SBHistory object. They allow you to refer to a profiles history, e.g. when it was run, who ran it, what the result was, etc. The SBHistory.ProfileName property will already have been set for you unless you are using a Main Interface script, in which case you must set it yourself as appropriate. Once the profile name has been set you can get the number of history records available using SBHistory.RecordCount. The  number of records available depends on how many times the profile has been run and the maximum history for that profile. Next you need to specify which history record you want to get the values of. You can do this by setting SBHistory.RecordIndex. By default it is set to zero, which is the index of the oldest history record. When you've set the profile name and record index you can then get the history information, e.g. SBHistory.RunResult.

 

The SBHistory object is accessible from Main Interface, Runtime and Profile Configuration scripts.

 

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

 


procedure Refresh;

 

This subroutine refreshes the profiles history. Note that the RecordCount may have changed and the RecordIndex is reset to zero.

 

 

Property AbortReason

 

If the profile was aborted then this read-only property returns the reason why it was aborted. Ignore this value if the profile was not aborted. See RunResult for the profiles run result.

 

Returns -1 on error or if the profile name has not been set.

 

 

Property BackupType

 

This read-only property returns the backup type. If the profile is a SmartSync profile, or was run as a restore, then ignore this value. If the profile is not a Fast Backup profile then it will also return that is was an incremental backup.

 

Returns -1 on error or if the profile name has not been set.

 

 

Property CloudContainer

 

This read-only property returns the name of the cloud bucket/container that was used. If the cloud was not used then an empty string is returned. For the type of cloud service used see CloudType.

 

Returns an empty string on error or if the profile name has not been set.

 

 

Property CloudType

 

This read-only property returns the type of cloud service used. If the cloud was not used then it will return 0.

 

Returns -1 on error or if the profile name has not been set.

 

 

Property ComputerName

 

This read-only property returns the name of the computer used to run the profile. For the name of the user see UserName.

 

Returns empty string on error or if the profile name has not been set.

 

 

Property DestDir

 

This read-only property returns the destination/right directory used for the profile. If the directory was overridden, e.g. via the command line, then you can check this using IsDestOverride.

 

Returns empty string on error or if the profile name has not been set.

 

 

Property DestSerial

 

This read-only property returns the destination drives volume serial number. There will not be a serial number if the profile used FTP, email, cloud, etc.

 

Returns empty string on error or if the profile name has not been set.

 

 

Property EmailHostname

 

This read-only property returns the hostname of the SMTP email server used to backup files to. If the profile is making a backup of emails then it is the POP3/IMAP4 email server. If the profile does not use an email server then an empty string is returned.

 

Returns empty string on error or if the profile name has not been set.

 

 

Property ErrMsg

 

If the profile failed because of a critical error then this read-only property contains the error message. See also RunResult.

 

 

Property FTPHostname

 

This read-only property returns the hostname of the FTP server used to copy files to and from. If the profile did not use an FTP server then an empty string is returned.

 

Returns empty string on error or if the profile name has not been set.

 

 

Property GroupName

 

If the profile was run as part of a group then this read-only property returns the name of that group. See GroupStartTime to get the date & time when the group was started.

 

Returns empty string on error or if the profile name has not been set.

 

 

Property GroupStartTime

 

This read-only property is the date & time when the profiles parent group was started. To get the name of the group see GroupName.

 

Returns 1.0 on error or if the profile name has not been set. It also returns 1.0 if the profile was not run as part of a group.

 

See also ProfileStartTime

 

IMPORTANT: The date & time is in the GMT/UTC timezone. Use SBSystem.GMTToLocal to convert it to your local timezone.

 

 

Property Is64Bit

 

This read-only property returns TRUE if the version of Windows that ran the profile was 64-bit. To get the version of Windows use WindowsVersion.

 

Returns FALSE on error or if the profile name has not been set.

 

 

Property IsDestOverride

 

If the destination/right folder was overridden, e.g. via the command line, then this read-only property will return TRUE.

 

Returns FALSE on error or if the profile name has not been set.

 

 

Property IsRestore

 

If the profile was run as a Restore then this property returns TRUE.

 

Returns FALSE on error or if the profile name has not been set.

 

 

Property IsSourceOverride

 

If the source/left folder was overridden, e.g. via the command line, then this read-only property will return TRUE.

 

Returns FALSE on error or if the profile name has not been set.

 

 

Property ProfileName

 

This property is used to set and return the name of the profile the history is for. If it has not been set then an empty string is returned. The profile name must be set before you can use any other function or properties in the SBHistory object.

 

Note that the profile name will have been set automatically unless it is a main interface script.

 

If you set the profile name to what it already is then nothing will happen.

 

The history data is cached, so to refresh it you must call Refresh

 

 

Property ProfileStartTime

 

This read-only property is the date & time when the profile started running. It is different from ThreadStartTime because the ProfileStartTime may never be set.

 

Returns 1.0 on error or if the profile name has not been set. It also returns 1.0 if the profile never started.

 

See also GroupStartTime

 

IMPORTANT: The date & time is in the GMT/UTC timezone. Use SBSystem.GMTToLocal to convert it to your local timezone.

 

 

Property ProfileType

 

This read-only property returns the type of profile.

 

Returns -1 on error or if the profile name has not been set.

 

 

Property RecordCount

 

This read-only property returns the number of history records there are for the profile. If the profile name has not yet been set (see ProfileName) then -1 is returned. If there is no profile history then 0 is returned.

 

Records are numbered from 0 (which is the oldest history record) upto RecordCount - 1 (which is the newest history record). Use the RecordIndex property to change the current history record.

 

 

Property RecordedInSBM

 

This read-only property returns TRUE if the history has been recorded in the SyncBack Management Service.

 

Returns FALSE on error or if the profile name has not been set.

 

 

Property RecordIndex

 

This property is used to set and return the index number of the current history record for the profile.

 

When a profile name is set (see ProfileName) then current index is set to 0, i.e. the oldest history record for the profile. If the profile name has not been set, or there is no profile history, then -1 is returned.

 

A record index can range from 0 to RecordCount - 1, i.e. the record list is zero based. If you attempt to set an invalid record index then it is ignored.

 

 

Property RunResult

 

This read-only property is the result of the profile run. See also ErrMsg for any critical error message. If the profile was aborted then see AbortReason for the reason it was aborted.

 

Returns -1 on error or if the profile name has not been set.

 

 

Property SourceDir

 

This read-only property returns the source/left directory used for the profile. If the directory was overridden, e.g. via the command line, then you can check this using IsSourceOverride.

 

Returns empty string on error or if the profile name has not been set.

 

 

Property SourceSerial

 

This read-only property returns the source drives volume serial number. There will not be a serial number if the profile used FTP, email, cloud, etc.

 

Returns empty string on error or if the profile name has not been set.

 

 

Property ThreadStartTime

 

This read-only property is the date & time when the profile was prepared so it would be ready to be run when needed. It is different from ProfileStartTime because the ProfileStartTime may never be set. For example, if a profile is run as part of a group then the profile may never start because a previous profile in the group may be aborted. In that case the ProfileStartTime is not set, but the ThreadStartTime always is. So the ProfileStartTime is when the profile actually started running (if at all).

 

IMPORTANT: The date & time is in the GMT/UTC timezone. Use SBSystem.GMTToLocal to convert it to your local timezone.

 

Returns 1.0 on error or if the profile name has not been set.

 

See also GroupStartTime.

 

 

Property UserName

 

This read-only property returns the users Windows login username. For the name of the computer see ComputerName.

 

Returns empty string on error or if the profile name has not been set.

 

 

Property WindowsVersion

 

This read-only property returns the version of Windows used to run the profile. To see if the version of Windows was 64-bit see Is64Bit.

 

Returns -1 on error or if the profile name has not been set.

 

 

 

 

 

All Content: 2BrightSparks Pte Ltd © 2003-2024