This is the second of three blogs explaining how to manage system variables.
-
This blog demonstrates a level of automation to change the variables and store them in toolbars.
Scripts
When saving the variable settings to an external file from the Systems Variable dialog box, you can save either a filtered list (by using the search with wildcards) or a selected list by selecting multiple variables (using the <CTRL> or <Shift> key to select more than one). If only one variable is selected, then all will be saved, as shown.
You have the option of file formats, as shown:
-
SVF is for reading (restoring) variables in the Systems Variable dialog box.
-
SCR is for restoring the variables through the AutoCAD Script command.
Script Files
To use the script file, type Script in the Command Line, then browse to the script file (with a *.scr extension). Select the file to open it. AutoCAD reads each line as if it were typed in at the command line. It skips any line that starts with a semi-colon (;) – this usually precedes variables that are read-only and cannot be changed.
You can also develop macros using such script formats. Similar to scripts, a macro is a series of keystrokes executed when the macro is launched. Scripts run the commands from the contents of a text file whereas macros run the commands from a text string within the macro, which is stored in the program.
Macros can be defined as commands through the CUI interface where the following can be done, as shown:
-
Create a new command.
-
Search for commands (which then can be edited).
-
Name the new command.
-
Create the macro:
a. Type in the commands exactly as you would in the command line.
b. “^C^C” means <CTRL> C, <CTRL> C, which cancels any ongoing command.
c. A space acts the same as an <Enter> key.
-
Assign an icon, or button image, to the command.
-
Drag the new command into the Quick Access bar.
Note: you can also drag the command directly to the Quick Access Bar while it is listed in the CUI interface, as shown.