How do I check to see if an environment variable exists?

Richard Gaskin ambassador at
Sun Nov 25 01:47:53 EST 2018

Stephen MacLean wrote:

 > Looking to see how I check to see if my standalone was launch via
 > command line with a parameter?
 > I know that when it’s launched via command line with a parameter in
 > windows, I will see a $0 (Name of executable) and $1 for the
 > parameter.
 > How would I test to see if the $1 variable exists?

    if "$1 is among the lines of the globalNames then ...

But that won't tell you if your app is running from the command line.

If the user double-clicks a document associated with your app, the OS 
will pass the path to the document to the app in $1.

To determine if an app is running facelessly from the command line 
(assuming you include -ui as an option with the command to bypass 
loading the GUI), see the environment function:

    if the environment is "command line" then ...

  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  Ambassador at      

More information about the use-livecode mailing list