GETPROPERTY - Read the value of an existing persistent name-value pair
<< Click to Display Table of Contents >> Navigation: Robo-FTP User's Guide > Script Programming > Script Commands > All Script Commands > GETPROPERTY - Read the value of an existing persistent name-value pair |
Syntax: |
GETPROPERTY |
[ name ] = [ variable ] |
Arguments: |
[ name ] |
Variable or string defining a named property |
|
[ variable ] |
A variable to store the property value retrieved from the Robo-FTP settings; the variable is created if it did not previously exist. |
Options: |
none |
|
This command copies the value of a persistent name-value pair into a script variable. A name-value pair with a matching [ name ] must have previously been created by the SETPROPERTY command, but not necessarily in the current instance of Robo-FTP. Passing an undeclared variable or a non-existent property name to the [ name ] argument will result in an error.
In this example properties are used to compose an automatic email message:
GETPROPERTY "LastDownloadName" dl_name
GETPROPERTY "LastDownloadDate" dl_date
SET body = "The last file downloaded was " + dl_name + "."
SET body = body + " It was transferred on " + dl_date + ". " + %crlf
GETPROPERTY "EmailNotifyAddress" email
SET subj = "Automatic download report (do not reply)"
CREATEMAIL "" email subj body ""
SENDMAIL "120.33.13.10" "Joe Blow" "[email protected]"
This example shows logic to gracefully detect and recover from an attempt to read the value of an undefined name-value pair:
GETPROPERTY "FileCount" files
IFERROR= $ERROR_SUCCESS GOTO nextstep
;; we reach this row if "FileCount" property did not already exist
SETPROPERTY "FileCount" 0
SETNUM files = 0
:nextstep
The READFILE and WRITEFILE commands are are also available for handling persistent data; especially data that is too long to save in properties.
Related command(s): SET, SETPROPERTY, READFILE
See also: User Settings vs. Shared Settings