Categories

AutoCAD 2015 and AutoCAD LT 2015 BibleAutoCAD 2015 and AutoCAD LT 2015 Bible

The most comprehensive AutoCAD book around!

Record macros with the Action Recorder

Since AutoCAD 2009, you can record macros for later use. You can include requests for user input and messages to make the macro work interactively.

When you save a macro, it has an ACTM filename extension. You’ll find it in your Support\Actions folder of your AutoCAD installation. You can share ACTM files with others.

Start by thinking about the conditions that you’ll need when you run the macro. Will you be in model space or paper space? The macro doesn’t keep track of all of the current settings. If a certain setting is necessary, use the system variable or the SETVAR command while recording the macro to make sure that you have the setup you’ll need at playback time.

Action Recorder macros have some limitations:

  • You can’t open files
  • You can’t grip edit or use PRESSPULL
  • You can’t load VBA files
  • Macros also don’t record changes to a dialog box, which means that you may need to use the command line version of a command. If you’ve worked with scripts, you’re familiar with this type of functioning.

You may find other limitations.

Did you find this tip helpful?
Don't miss new tips!

Plus get a free Dynamic Blocks tutorial

Enter your name and email below

You’ll find the Action Recorder on the Tools tab, in the Action Recorder panel. You can also choose Menu Browser (the A button)> Tools> Action Recorder.

Here’s an example of how you would create a macro to change all objects to the default 0.25mm lineweight. You might get drawings from a company that adds lineweights to objects. Moreover, their default might be different. So this macro sets the default to 0.25, turns on the display of lineweights, and then uses the CHPROP command to change the lineweight of selected objects to the default. At the end, the macro turns off lineweight display.

Figuring out which commands to use often involves some research. For example, I knew that I could turn the lineweight display off and on using the button on the status bar, but I couldn’t do that in the macro, since I didn’t know which way the display would be when I played back the macro. If I wanted to turn the display on, and it was already on, clicking the button would turn it off! So I needed to find the system variable involved, which was LWDEFAULT. Then, it was easy to turn it on and off as needed.

When you’ve figured out the steps that you want to take, and tried them out a couple of times in different situations, you’re ready to record.

Choose Tools tab> Action Recorder panel> Record. Your cursor now has a red dot, to show you that you’re recording.

Go through the steps that you practiced. When you’re done. click the Stop button that has replaced the Record button. You now have the opportunity to name and save the macro, as well as choose a few options.

Here is the command line that I created as I recorded:

Because I specified all at the Select objects: prompt, the macro will always select all objects. I tested that by adding more objects with a non-default lineweight; they were also changed.

Here’s what the macro looks like in the Action Recorder drop-down window:

I might want to be able to select individual objects. Letting the user select objects makes the macro interactive, and it’s a very helpful feature.

To do this, I reorganized the macro and used the SELECT command before the CHPROP command. While recording, I simply picked any objects. For the CHPROP command, I then used the p (Previous) option at the Select objects: prompt. When I was done, the macro looked like this:

Then I right-clicked the Select Objects item, and chose Request User Input, as shown below:

When I ran the macro, I got a dialog box asking if I wanted to provide user input. By accepting that option, I was able to either select objects, or enter all.

Do you use the Action Recorder? Leave a comment about how you use it!

11 comments to Record macros with the Action Recorder

  • Can forgotten actions be appended to an existing action macro? I can’t seem to modify them once they’re recorded.

    Thanks,

    SG

  • Ellen

    Scott, You should be able to display the macro in the “Action Tree” below the Action Recorder panel by expanding the Action Recorder panel, then right-click an action, and choose Edit. But I’m not able to display it now–not sure why (I have a screenshot of it in my book, so I know it exists.) When I click the panel name, nothing happens. Do you see the Action Tree? But I’m not sure if you can actually add steps that you left out.

  • sathish

    Dear sir/madam

    i have recorded tha macro same like you mention. Is it possible to run multiple files like batch proces. thank you

  • […] If you want to record a sequence of actions in a robust way (a sequence that won’t break easily when you replay the macro), concentrate on using keyboard actions where possible, rather than mouse actions. Start your macro by moving the screen cursor to a specific location, from which you then develop the rest of the macro actions. An example is to use the Ctrl + HOME to get the cursor to the beginning of a document. Good practice also includes making sure that the cursor also ends up in a suitable place when the macro finishes, especially if you plan on sequencing macros one after another. You may be able to get further tips by looking at how people use macros in other contexts. […]

  • Ed Santiago

    Hi Ellen,
    How do I migrate a customized toolbar in AUTOCAD 2002 to Autocad 2010 or the lasted version of Autocad?
    Many thanks in advance.
    Kind regards.,

    Ed

  • Behrouz

    Hello Ellen,

    I tried to use Action recorder to automatically create Blocks in CAD. But when it comes to do something inside the opened windows, it does not show that in the command line so I can get what is happening.
    I’d appreciate if you could kindly help me in this case.
    Regards,
    Behrouz

  • nalieke

    Hello,

    I’ve made an action macro, but i would like to make a keyboard shortcut for this macro. I can’t find my macro in the list of commands in the cui?

  • Peter

    Nalieke, I have made a few action record macros and what I did was, I gave it a very short name or just the initials. When I wanted to run the macro I just typed the name in and hit space bar or enter. For example, I made one that would renumber items for me and I named it “rew” when I wanted to run it I typed rew enter. Good luck

  • Gary Gebhard

    Ellen,

    I sent you a macro last year that puts a horizontal and vertical construction line on a drawing with one click. Do you have a copy of that macro so I can recreate the tool bar button here at my new office? Thanks.

  • Good Day, i haven’t learn more about the autor card which is very painful to my status and i don’t mind if i can get it done here it be my pleasure to have a full knowledge about the autor card and some aspects that relate to construction. Thank you. Akande Taofeek.

  • Sujan

    Hello,
    How to record Hatching any selected pattern name? I tried but it switches to current setting.
    Is there a way to record any Hatch Pattern with specified setting and Layer with Script or Action Recorder

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>