'
' Example script for 2BrightSparks SyncBackPro V8 that removes the leading zeros
' from the day and month variables.
'
' SBLang=Basic
'
' http://www.2BrightSparks.com/
'

' The name of the variables
const MyDayName = "NoZeroDay"
const MyMonthName = "NoZeroMonth"

'-----------------------------------------------------------------------------
'-DO NOT MODIFY ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING !-
'-----------------------------------------------------------------------------

'
' This is a runtime script and a configuration script
'
' It must be a configuration script otherwise the variable will not be used
' when you modify the script
'
Function Description(ByRef ScriptType)
  Description = "Adds new variables " & MyDayName & " and " & MyMonthName 
  
  ScriptType = SCRIPTTYPE_RUN + SCRIPTTYPE_CONFIG
End Function

'
' This subroutine is called when the variables are initialised. This is either
' when the profile is run, or when the variables are being checked during profile
' configuration. The check is made to make sure the variable actually exists.

' Note that you need to be careful as many things haven not been initialised or
' created when this is called, e.g. no locations. It is called very early during
' the profile run.
'
Sub InitialiseVars(Checking)
  SBVariables.SetVar(MyDayName, CStr(CInt(SBVariables.GetVar("%DAY%"))))
  SBVariables.SetVar(MyMonthName, CStr(CInt(SBVariables.GetVar("%MONTH%"))))
End Sub
