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:
| Version | Version of the script file. If this value differs from the SmartSync version, the file will not be interpreted |
| TRN | Transaction 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
| NUMBER | Receive 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
| NAME | Path+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
| TYPE | Type: 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
| NAME | Name 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
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
| CONTENT | Number 1 |
| CONTENT | Number 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
| NAME | Name of program to execute |
| TIME | maximum 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
| NAME | Path 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
| IPADDR | IP address of the server |
| DIR | Path to connect to |
| USER | Username for login |
| PWD | Password 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
| NAME | Name of source file |
| NAME | Name 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
| DIR | local 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
| DIR | local 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
| NAME | Name of source file |
| NAME | Name 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
| NAME | Name of registry entry |
| TYPE | Type 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
| COMMAND | Command to be evaluated |
| STATEMENT | all Commands under this tag are executede if the evaluation was true |
| STATEMENT | all 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
| DIR | Source path |
| DIR | Target 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
| IPADDR | IP address to ping |
| NUMBER | number of pings to be successful in a sequence |
| TIME | delay 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
| NAME | Name under which the message has to be registered |
| CONTENT | wParam value of the message |
| CONTENT | lParam 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
| NAME | Name of registry entry |
| TYPE | Type of entry: 0 = DWORD, 1 = STRING |
| CONTENT | Value 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
| TIME | time 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
| CONTENT | String 1 |
| CONTENT | String 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
| CONTENT | String 1 |
| CONTENT | String 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
| CONTENT | String to write to trace window |
Return
TRUE, if operation succeeded
Example
< COMMAND >
  < TRACE >
    < CONTENT >
      < VALUE > = hello
writes "hello" to trace window