Chapter 30. Creating Macros and Slide Shows
Script files are like macros that you create in your word processor or spreadsheet. They automatically execute a series of commands. You can use script files to automate plotting, set up a drawing, clean up a drawing, create a slide show, or do any repetitive task. By running a script file on a number of drawings, you can complete a time-consuming task in a fraction of the time.
You can also record actions on the screen and save them as a macro. Doing so saves you the time of figuring out the exact command-line sequences.
If you need to put together just a few commands that you might use another time for other drawings, you may want to consider creating a menu item or toolbar button instead. Chapter 29 explains how to customize toolbars, and Chapter 33 explains how to customize the ribbon and menus.
Creating Macros with Script Files
A script file contains a list of commands and options. To create a script file, you need to think out the commands that you want to execute, as well as their options and prompts. Then you create the text for the script file. Script files have the following characteristics:
They must use the
.scr
filename extension.They are text-only (ASCII) files.
They must use command-line syntax only (which can include AutoLISP expressions).
Creating the script file
You can create the script file using a text editor, such as Notepad. For early practice with script files, type each command on its own line. A blank space is equivalent ...
Get AutoCAD® 2009 & AutoCAD LT® 2009 Bible now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.