2012

Table Of Contents
A script can execute any command at the command prompt except a command
that displays a dialog box. In most cases, a command that displays a dialog
box has an alternative version of the command that displays command
prompts instead of a dialog box.
Script files can contain comments. Any line that begins with a semicolon (;)
is considered a comment, and it is ignored while the script file is being
processed. The last line of the file must be blank.
All references to long file names that contain embedded spaces must be
enclosed in double quotes. For example, to open the drawing my house.dwg
from a script, you must use the following syntax:
open "my house"
The following commands are useful in scripts:
'DELAY Provides a timed pause within a script (in milliseconds)
RESUME Continues an interrupted script
RSCRIPT Repeats a script file
When command input comes from a script, it is assumed that the settings of
the PICKADD and PICKAUTO system variables are 1 and 0, respectively;
therefore, you do not have to check the settings of these variables.
A script is treated as a group, a unit of commands, reversible by a single U
command. However, each command in the script causes an entry in the undo
log, which can slow script processing. If you like, you can use UNDO Control
None to turn off the undo feature before running the script, or you can write
it at the beginning of the script itself. Remember to turn it back on (UNDO
Control All) when the script is finished.
The script that is running stops when another script command is invoked.
Overview of Command Scripts
To create a script that changes settings in a drawing
This script turns on the grid, sets the global linetype scale to 3.0, and sets layer
0 as the current layer with red as the color.
1 In a text editor, enter grid on.
2 On the next line, enter ltscale 3.0.
3 On the next line, enter layer set 0 color red 0.
74 | Chapter 6 Command Scripts