SETPROPERTY - Save or update a persistent name-value pair
<< Click to Display Table of Contents >> Navigation: Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands > SETPROPERTY - Save or update a persistent name-value pair |
Syntax: |
SETPROPERTY |
[ name ] [ value ] |
Arguments: |
[ name ] |
Variable or string defining a named property |
|
[ value ] |
Variable or string defining the value to associate with [ name ] |
Options: |
none |
|
This script command creates or updates a persistent name-value pair that is saved in the Robo-FTP settings. The property [ value ] may be retrieved by passing the same property [ name ] to the GETPROPERTY command. Property values may be retrieved by any current or subsequent instance of Robo-FTP with access to the same settings context. Use of an undeclared variable for either argument will result in an error.
Consider the following example that sets properties to keep track of the last successful download:
:loop
FTPLOGON "ftp.mydomain.com" /user="UserID" /pw="secret"
GETSITEFILE "*.bak"
RCVFILE %sitefile
IFERROR GOTO done
SETPROPERTY "LastDownloadName" %sitefile
SETPROPERTY "LastDownloadDate" %datetime
:done
FTPLOGOFF
PAUSE /for=300 ;; sleep 5 minutes
GOTO loop
In this example, user-supplied logon credentials are saved as properties for later use:
PROMPT user "Enter your Username"
SETPROPERTY "LogonID" user
PROMPT pass "Enter your Password"
SETPROPERTY "LogonPW" pass
When Robo-FTP is launched by a Windows user account that lacks administrative privileges the name-value pair created or updated by the SETPROPERTY command is only available when Robo-FTP is launched by that specific Windows account. In contrast, when properties are set in an instance of Robo-FTP launched by an administrator, the saved value is available to any other users of the computer that have not configured their own conflicting value. When a conflict arises between the current user's configured settings and the shared system settings, Robo-FTP is controlled by the current user's settings.
The WRITEFILE and READFILE commands are are also available for handling persistent data; especially data that is too long to save in properties.
Related command(s): SET, GETPROPERTY, WRITEFILE
See also: User Settings vs. Shared Settings