A command script (.scr file) runs a list of commands and answers in the drawing as if you typed them. Use scripts to repeat set-up steps, such as making layers or drawing a standard border.
Before you start
- Needs a licence that allows editing the drawing.
- A text file with the
.scrextension.
Steps
- Write the script in a text editor. Each entry is what you would type at the command line.
- In Stratal CAD, choose File > Run Script… and pick the file. Or type
SCRIPT(aliasSCR) and, at "Enter script file name (.scr)", type its name. - The command line says "Running script name.scr (n entries)." and runs each entry. Each command is its own undo step.
How a script is read
| In the file | Means |
|---|---|
| A space or a line end | Ends an entry (like pressing Enter) |
| Two spaces or line ends in a row, or an empty line | An Enter of its own, which at the command prompt repeats the last command |
| Text in double quotes | One entry with its spaces, for example -LAYER M "Board room" |
A line starting with ; |
A comment, ignored |
Example
A script that makes two layers and draws an A3 frame at 1:1 in mm:
; set-up.scr
-LAYER M Frame C 7 Frame
-LAYER M "Title block" C 3 "Title block"
-LAYER S Frame
RECTANG 0,0 420,297
Tips and common mistakes
- A name typed without a folder is looked for next to the drawing;
.scris added when you give no extension. - A script may run another script, up to eight deep.
- Scripts use the same commands as the ribbon, plugins and automation, so anything you can type can go in a script.
- Watch for an extra space: two in a row is an Enter, which may finish or repeat a command.
Troubleshooting
| Message or symptom | What it means and what to do |
|---|---|
| "The script ... could not be opened." | The file is not there or cannot be read. Check the name and folder. |
| "Scripts started each other more than 8 deep; this one was not run." | Scripts call each other too deeply, possibly in a loop. Check which script runs which. |
| "Invalid input (...)" in the middle of a script | An entry did not fit the prompt. Check the order of answers against the command's prompts. |
Related
Related
- From install to your first drawing
- Your first project
- Using the command line and prompts
- Using the right-click menu
- Rulers and reading a position
- Getting help inside Stratal CAD
Still stuck? Open a support ticket or use Help, then Contact support in Stratal CAD.