SmartSync

This document contains the script syntax of XML-files, which can be interpreted by SmartSync.

RootTag and Attributes

Each script XML files has to start with a root tag. This root tag is SYNCSCRIPT. The root tag needs the following attributes:
VersionVersion of the script file. If this value differs from the SmartSync version, the file will not be interpreted
TRNTransaction number of the script. This is a free number which can be useful in differen manners (see below)

Commands

In the script file, the root tag can have an unlimited amount of subitems. Each subitem has to be a command. The tag for a command is COMMAND. This tag again has to have a subitem, which is a tag for a valid command.

ADRLISTENON

Description

Use this command to determin if the system which executes the script is part of a receive group

Parameters

NUMBERReceive ID to check

Return

TRUE, if the system is part of the receive group

Example

< COMMAND >
  < ADRLISTENON >
    < NUMBER >
      < VALUE > = 21

checks if the system listens to the receive ID 21

ADRUPDATE

Description

Rebuild the local address tree from a address tree metafile

Parameters

NAMEPath+Name of address tree metafile

Return

TRUE, if the files was found and the operation succeeded

Example

< COMMAND >
  < ADRUPDATE >
    < NAME >
      < VALUE > = c:\tmp\adrtree.dat

rebuilds address tree from the file c:\tmp\adrtree.dat

BOOT

Description

Reboot, Shutdown the system

Parameters

TYPEType: 0 = Reboot, 1 = Shutdown, 2 = Poweroff

Return

the programm does not return from the function

Example

< COMMAND >
  < BOOT >
    < TYPE >
      < VALUE > = 0

reboots the system

DELETEFILE

Description

Deletes a given file

Parameters

NAMEName of file to delete

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < DELETEFILE >
    < NAME >
      < VALUE > = c:\Content\OldVideo.mpg

deletes the file c:\Content\OldVideo.mpg

DELETEPATH

Description

Deletes all files from a given path. The path itself is not deleted

Parameters

NAMEName of path

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < DELETEFILE >
    < NAME >
      < VALUE > = c:\Logging

deletes all files from the path c:\Logging

EQ

Description

compares to numbers

Parameters

CONTENTNumber 1
CONTENTNumber 2

Return

TRUE, if the two Numbers are equal

Example

< COMMAND >
  < EQ >
    < CONTENT >
      < VALUE > = 1
    < CONTENT >
      < VALUE > = 1

compares the two numbers and returns TRUE

EXECUTE

Description

Executes a given program. If a time is given as parameter, the program execution is terminated after the time is expired.

Parameters

NAMEName of program to execute
TIMEmaximum time in milliseconds, the program is allowed to run

Return

exit code of the executed program

Example

< COMMAND >
  < EXECUTE >
    < NAME >
      < VALUE > = c:\winnt\calc.exe
    < TIME >
      < VALUE > = 5000

executes c:\winnt\calc.exe and terminates it after 5 seconds

EXECUTESCRIPT

Description

executes a given script file

Parameters

NAMEPath and name of script file

Return

return value of the executed script

Example

< COMMAND >
  < EXECUTESCRIPT >
    < NAME >
      < VALUE > = c:\scripts\subscript.xml

executes the script file c:\scripts\subscript.xml

FTPCONNECT

Description

connects to a ftp server

Parameters

IPADDRIP address of the server
DIRPath to connect to
USERUsername for login
PWDPassword for login

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < FTPCONNECT >
    < IPADDR >
      < VALUE > = 1.110.110.66
    < DIR >
      < VALUE > = Elfi

connects to ftp server 1.110.110.66 to the path Elfi

FTPDISCONNECT

Description

cuts an open ftp connection

Parameters

none

Return

returns always TRUE

Example

< COMMAND >
  < FTPDISCONNECT >

FTPDOWNLOAD

Description

Downloads a file from the ftp server. A ftp connect has to be done before.

Parameters

NAMEName of source file
NAMEName of target file

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < FTPDOWNLOAD >
    < NAME >
      < VALUE > = News.txt
    < NAME >
      < VALUE > = c:\Content\News.txt

downloads the file News.txt from the ftp server to the local path c:\Content\News.txt

FTPSYNCTOLOCAL

Description

Synchronizes the ftp server directory to a local directory. Subdirectories are not uploaded. A ftp connect has to be done before.

Parameters

DIRlocal path to synchronize to

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < FTPSYNCTOLOCAL >
    < DIR >
      < VALUE > = c:\Logging

Uploads all files in the path c:\Logging to the ftp server.

FTPSYNCTOREMOTE

Description

Synchronizes a local directory to the ftp server´s directory. A ftp connect has to be done before.

Parameters

DIRlocal path to synchronize with

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < FTPSYNCTOREMOTE >
    < DIR >
      < VALUE > = c:\Content

Downloads all files from current ftp directory to the path c:\Content

FTPUPLOAD

Description

Uploads a file to the ftp server. A ftp connect has to be done before.

Parameters

NAMEName of source file
NAMEName of target file

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < FTPUPLOAD >
    < NAME >
      < VALUE > = c:\Log.txt
    < NAME >
      < VALUE > = Log.txt

uploads the file c:\Log.txt to the ftp server

GETREG

Description

Reads an entry from registry.

Parameters

NAMEName of registry entry
TYPEType of entry: 0 = DWORD, 1 = STRING

Return

Value of the registry entry, if exists

Example

< COMMAND >
  < GETREG >
    < NAME >
      < VALUE > = HKEY_LOCAL_MACHINE\Software\1 mal 1 Software GmbH\DS2000\SmartSync\UpdateTrn
    < TYPE >
      < VALUE > = 0

gets the value of the UpdateTrn from registry

GETSCRIPTTRN

Description

gets the transaction number of the current script. See Attributes.

Parameters

none

Return

the transaction number of the current script

Example

< COMMAND >
  < GETSCRIPTTRN >

IF

Description

executes different script parts, depending on the result of an operation.

Parameters

COMMANDCommand to be evaluated
STATEMENTall Commands under this tag are executede if the evaluation was true
STATEMENTall Commands under this tag are executede if the evaluation was not true

Return

TRUE, if the evaluation command did not cause an error

Example

< COMMAND >
  < IF >
    < COMMAND >
      < FTPCONNECT >
        < IPADDR >
          < VALUE > = 1.110.110.66
        < DIR >
          < VALUE > = Elfi
    < STATEMENT >
      < COMMAND >
        < TRACE >
          < CONTENT >
            < VALUE > = succeeded
    < STATEMENT >
      < COMMAND >
        < TRACE >
          < CONTENT >
            < VALUE > = failed

MOVEPATHDURINGSTARTUP

Description

moves all files under a path during startup to a different path.

Parameters

DIRSource path
DIRTarget path

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < MOVEPATHDURINGSTARTUP >
    < DIR >
      < VALUE > = c:\Update
    < DIR >
      < VALUE > = c:\Winnt\Ds

moves all files found under c:\Update during startup to the path c:\winnt\ds

PING

Description

pings a foreign host

Parameters

IPADDRIP address to ping
NUMBERnumber of pings to be successful in a sequence
TIMEdelay in milliseconds between two pings

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < PING >
    < IPADDR >
      < VALUE > = 1.110.110.66
    < NUMBER >
      < VALUE > = 10
    < TIME >
      < VALUE > = 1000

pings 10 times the 1.110.110.66. Between two pings, one second delay is waited. if all 10 pings succeeded, the return value is true

POSTMESSAGE

Description

broadcasts a windows message

Parameters

NAMEName under which the message has to be registered
CONTENTwParam value of the message
CONTENTlParam value of the message

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < POSTMESSAGE >
    < NAME >
      < VALUE > = GM_SHUTDOWN

broadcasts a message which is registered under the name GM_SHUTDOWN

SETREG

Description

Writes an entry to registry.

Parameters

NAMEName of registry entry
TYPEType of entry: 0 = DWORD, 1 = STRING
CONTENTValue of the entry

Return

Value of the registry entry

Example

< COMMAND >
  < SETREG >
    < NAME >
      < VALUE > = HKEY_LOCAL_MACHINE\Software\1 mal 1 Software GmbH\DS2000\SmartSync\UpdateTrn
    < TYPE >
      < VALUE > = 0
    < CONTENT >
      < VALUE > = 99

writes the entry UpdateTrn with a value of 99 to the registry

SLEEP

Description

sleep for a certain amount of time

Parameters

TIMEtime to sleep in milliseconds

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < SLEEP >
    < TIME >
      < VALUE > = 10000

sleeps for 10 seconds

STRCAT

Description

adds two strings

Parameters

CONTENTString 1
CONTENTString 2

Return

sum of two strings

Example

< COMMAND >
  < STRCAT >
    < CONTENT >
      < VALUE > = c:\Content
    < CONTENT >
      < VALUE > = \Test.mpg

returns the string c:\Content\Test.mpg

STRCAT

Description

compares two strings

Parameters

CONTENTString 1
CONTENTString 2

Return

0, if strings are equal

Example

< COMMAND >
  < STRCMP >
    < CONTENT >
      < VALUE > = ABC
    < CONTENT >
      < VALUE > = ABC

returns 0

TRACE

Description

writes a string to SmartSync´s trace window

Parameters

CONTENTString to write to trace window

Return

TRUE, if operation succeeded

Example

< COMMAND >
  < TRACE >
    < CONTENT >
      < VALUE > = hello

writes "hello" to trace window