17 1 2 Commands and Special Variables

LANSA Technical

17.1.2 Commands and Special Variables

The following commands and special variables may be used anywhere in a command string except inside a [//] or {//} prompt. Examples of the use of all these commands and special variables can be found in the XST files in \X_WIN95\X_LANSA\SOURCE shipped with Visual LANSA to provide custom execute dialogs from within the LANSA development environment:

Variable Name

Description

%basepath%

It is substituted with the name of the path up to (but not including) the X_LANSA directory of the current Visual LANSA system. For example c:\x_win95.

%browser%

Determine the user's browser and expand to the full path of the browser

%editor%

It is substituted with the string NOTEPAD.EXE under Windows.

%if% & %endif%

%if%<expression>?<true text>:<false text>%endif%

Include the 'true text' if the expression is true, otherwise include the 'false text', if it exists. The expression and text cannot include a prompt. The expression can either be an "=" or "!=" type of expression. The comparisons are case insensitive. The if statement finishes at the %endif%. The if statement cannot be nested.
E.g. The following line compares the variable LANG to the string 'NAT' and if it is not equal, puts a '+' followed by the value of %lang% in the command line:

   %if%%lang%!=NAT?+%lang%%endif%

The following 4 lines prompt for "Debug", "Device Name" and "Message Queue", and if      
%dbug% is equal to 'Y', puts "+BDEBUG+%dvic%+%msgq%" on the command line:

   %promptonly%[N/Debug/DBUG]
   %promptonly%[DSP01/Device Name/DVIC]
   %promptonly% [DSP01/Message Queue/MSGQ]
   %if%%dbug%=Y?+BDEBUG+%dvic%+%msgq%%endif%

%JavaClient%

The Java-Client physical path.

%noshowdialog%

Do not display the dialog. Use the defaults and merge values as if the user had just pressed OK on the dialog without changing any values. This is provided for use in the merge file so that a calling program can control whether or not to display the dialog.

%nospaces%

Do not add a space for each new line. Spaces must be manually included where necessary. This is primarily provided in order to assemble a URL from separate lines in the X_START file

%promptonly%

Only prompt for the value that follows. Do not insert the text at that point in the file. The dialog will just set the value of the symbolic name. A reference to the Symbolic Name ANYWHERE in the X_START file will insert its value there. See %if % examples

%show%

Causes the final command (after prompting) to be displayed before an attempt is made to execute it. This is useful for debugging custom scripts.

%<symbol>%

All symbolic names provided in prompts are accessible via this syntax. This includes values that are prompted for and the symbolic names defined in the merge file. The maximum number of symbolic names is 1024. If there are more symbolic names than this they are ignored

%workpath%

Sets the current directory to this value when the assembled command line is executed, e.g. when X_RUN.exe is executed. If this is not specified, the current directory is left unchanged.

Note: When x_start is called from the Visual LANSA Execute Dialogs the current directory is set to \x_win95\x_lansa\source, which is the same as the location of the XST files

%<environment variable>%

If a match is not found for the variable name, then it is evaluated as an environment variable. If it exists, its value is substituted for the variable name.

%X_RUN_specific%

If %basepath% of X_RUN.exe is detected then the value of the following %X_RUN_specific% is evaluated.
If %basepath% of X_RUN.exe is not detected then any %X_RUN_specific% is ignored.

*password

A special value for a default value. Indicates that the parameter is a password and characters entered are masked with asterisks. A value must be entered

*password_optional

The same as *password but a value is optional

*optional_data_<value>

A special value for a default value. Indicates that entering a value is optional. If there is text for <value> it's the default value. E.g. *optional_data_ will display an empty field. *optional_data_adefault will display 'adefault' in the field

 

 

Note: If any of these commands are mistyped and the '%' is the first character on the line, the command will be taken as a Symbol Name and the rest of the line will be set as the value of that symbol. The resulting command line will look as if the whole line has been ignored.