Helpful Commands in Macros

Two commands are particularly helpful in creating macros:
 
Tip:  
For more help on using commands, see the online help available from the Command Navigator. Simply select a command and then select the Help button at the bottom of the Command Navigator.

file text write

Lets you write a general-purpose text file from Adams View, using information and formatting that you control. You can use a text file to create:
Standard reports
Data files for other applications
Adams View command files
Scripts for executing other applications
You can specify to write to a file, a variable, both, or neither. If writing to a file, you must open it first using the file text open command.
If you specify:
Just the file_name, Adams View writes the output to that file.
Just the variable_name, Adams View assigns the text string to that variable.
Both file_name and variable_name, Adams View performs both actions.
Neither, Adams View assumes the last opened, written, or read file is the intended destination. If you perform a write after a read, you should explicitly identify the file with the file_name parameter, so Adams View does not overwrite the file you last read from.

Parameters

 
file_name
(optional)
Specifies the name of the text file to be written. The proper extension is the default, but you can be override it by supplying a different extension.
It's not necessary to enclose the file name in quotes if it only contains alpha-numeric characters and starts with a letter. If you want to include other characters, such as a '.' for an extension or '/' or '[]' for directory paths, you must enclose the name in quotes.
variable_name
(optional)
Specifies a variable to which Adams View stores a formatted string.
format_for_output
(required)
Specifies the format of the output text. Output formats are a mixture of text and conversion specifications. Each conversion specification usually has a matching argument in the values_for_output parameter. A conversion specification begins with a percent sign, %, and is terminated by a letter or another percent sign.
The conversion specifications provided by Adams View are a subset of those used in the ANSI-C programming language. Valid conversion specifiers are:
% - Literal percent sign ("%%" is output as "%")
d - Integer in base 10, 1, or 123
e - Exponential floating point, 1.23e-04
E - Exponential floating point, 1.23E-04
f - Fixed point real, 345.67
g - General fixed or floating point (depending upon magnitude)
G - General fixed or floating point (depending upon magnitude)
i - Same as d, above
o - Unsigned integer in base 8 (o is for octal)
s - Character string
u - Unsigned integer in base 10
x - Unsigned integer in base 16 (decimal 10 is "a", 11 is "b", and so on)
X - Unsigned integer in base 16 (decimal 10 is "A", 11 is "B", and so on)
 
Most conversion specifications can contain flags between the leading percent sign and the terminating conversion specifier. These flags allow you to further refine the format of your output. Some of the valid flags are:
- Indicates that the output is to be left justified in the field, with the default being right justification. This is only useful when the field width is specified (see below).
+ Forces a sign to be output for all numeric values. For example:
... FORMAT="%+d %+d" VALUES=(-1), (1)
         produces:
-1 +1
0 Forces output of leading zeros when a field width is specified.
" " Blank. Same as + but no explicit + sign, only a blank.
Field width is specified by prefixing the conversion specifier with a number. It determines how much space is to be reserved for the output text. For example, the following format and values:
... FORMAT="%03d%6d" VALUES=(5),(7)
generates the following as output ('.' is used to denote blank space in this example only):
"005.....7"
 
You specify precision by entering a decimal point followed by a number. You enter the precision after the field width. For example:
... FORMAT="%5.2f %010.3e" VALUES=(2.3),(5.4)
produces the output:
" 2.30 05.400e+00"
 
Values for output are converted to the appropriate type for the conversion specifier, and using expressions is extremely useful here.
You can write information from the Adams View database to the text file by using data access references in the value expressions. For example, VALUES= (.mod1.par1.mass) writes the mass of part par1. For more information on expressions and database access, see Adams View Function Builder online help.
values_for_output
(optional)
Specifies the values to be placed in the output string.
newline
(optional)
Controls whether or not file write text causes the output to terminate the line with this write command. If newline is no, then subsequent write commands produce output on the same line. If newline is yes (the default), then any succeeding write command produces content on a new line.
Values are: yes and no. The default is yes.

system

Issues a device-dependent operating system command. You can select to display the results of the command in the Information Window or the Adams View Log file.

Parameters

 
command_text
Specifies the text for a device-dependent operating system command. See your operating system documentation for more information.
send_output_to_info_window
Specifies whether or not to send the output from the command to the Information window. The default is to send the output to the Information window (on).
echo_to_logfile
Specifies whether or not to send the standard output and standard error streams from a system command to the Adams View log file. The default is to not send the output to the log file (off).

Examples

The following example issues a Linux-appropriate command to remove the file named test.txt without displaying the command in either the Adams View Information window or a log file:
SYSTEM COMMAND="rm test.txt" SEND=OFF ECHO=OFF