Error getting tags :
error 404Error getting tags :
error 404 $ | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Expander triangle

Platform Support
Mac OS X,Windows,Linux
None required
The character $ (dollar sign) is used to indicate an environment variable on Unix systems and a command-line parameter on Unix or Windows systems.

put $LOGNAME into field "Login Name"
if $0 is not myAppName then answer "Problem initializing!"

Additional Comments
Expander triangle

Use the $ keyword to interact with the system environment and to find out what arguments were used if the application was started up from the command line.


The $ character marks two kinds of special variables: command-line arguments (on OS X, Unix, and Windows systems) and environment variables (on OS X and Unix systems).

If you start up the application from the command line (on OS X, Unix or Windows systems), the command name is stored in the global variable $0 and any arguments passed on the command line are stored in numbered variables starting with the $ character. For example, if you start the application by typing the following shell command:

myrevapp -h name

then the global variable $0 contains "myrevapp" (the name of the application), $1 contains "-h", and $2 contains "name".

If an argument includes spaces, it must be enclosed in quotes on the command line:

myrevapp -in "new info.txt" -out "new info.xml"

Gotcha: On Windows XP systems, individual arguments passed on the command line are placed in separate variables ($1, $2, and so on) only if they are quoted on the command line. Otherwise, all arguments are placed in the $1 variable.

On Unix and OS X systems, a variable whose name begins with the $ character is exported to the application's environment, and is inherited by processes started up by the shell function or the open process command. Use this technique to create your own environment variables.

You can access existing environment variables by prepending the $ character to the environment variable's name. For example, the following statement gets the contents of the LOGNAME environment variable:


User Comments
Expander triangle
User thumbnail
Mark Wieder
May 3, 2009
get $# will return the number of commandline arguments (including $0)
User thumbnail
Sep 9, 2009
On Windows you can open double-clicked files associated with standalone based on the command line arguments, but on Mac the path of the double-clicked file is not passed to the standalone in the command line arguements. Anybody know how to find the path of a double-clicked file on Mac so it can be opened by the standalone when it is double-clicked?
User thumbnail
Sep 9, 2009
Found answer to my own question. On Mac to launch a file assocated with a standalone when it is double clicked, you can do:

on appleEvent pClass, pID, pSender
if pClass is "aevt" and pID is "odoc" then
request appleEvent data
put it into theFiles ## files OS is requesting your application opens, one per line
if theFiles is not "not found" and theFiles is not empty then
## code to open theFiles
end if
pass appleEvent
end if
end appleEvent

(Trevor DeVore originally posted a similar solution on the use-rev list which is where I got this information. Thanks Trevor.)
User thumbnail
Oct 8, 2009
Exercise caution when using environment variables. Users can change them at runtime which can cause unexpected values. Depending on your implementation, this could open your app up to exploitation by malicious users.