How to create a script in AutoCAD?

If you want to automate repetitive tasks, then you should use scripts.
Scripts are instructions executed by computer which could alternatively be executed one by one, by a human operator.

  1. Step 1:

    Creating a script is actually a simple action which imply to create a set of instructions that are exceuted automatically by a script interpreter.
    These instructions can be executed within any text editor, such as Notepad.

  2. Step 2:

    AutoCAD commands that normally you would execute one by one are written in the text file as lines.
    Let’s make a simple script that creates automatically three UCS’s: Front, Top and Right.

  3. Step 3:

    Comments can also be included in the script file.The lines that contains the ‘;’ sign are interpreted as comments.

  4. Step 4:

    Just type into Notepad these sets of instructions or copy&paste them from this webpage.

    ;This is a comment. ;
    ;Comments will not be interpreted by application. ;
    _-view ;This it’s the first command that will be interpreted
    Front ;Set the view to Front
    UCS ;Starts the User Coordinate System command
    na ;NAmed option
    s ;Save the UCS…
    Front ;… with the name ‘Front’
    _-view ;Starts the view command…
    Top ;…and sets the view to Top
    UCS ;Same steps as above!
    Right ;The last view is named ‘Right’

  5. Step 5:

    Don’t forget to save the file with the .scr extension!
    Type 'scr' at the command line if you want to run a script!