If you find yourself using the same combination of commands and options over and over, you can easily create a custom command that executes the combination with a click of a button or a menu item. In this tutorial, I explain the basics of AutoCAD’s menu syntax so that you can create your own commands. No programming required!
- Enter cui at the command line/dynamic tooltip to open the Customize User Interface dialog box.
- In the Command List pane, click New (Create a New Command).
- In the Properties pane, enter a name for the command in the Name text box. Also enter a description in the Description text box.
- If you think your command will be long or need more than one line, click in the Macro text box and then click the Ellipsis button that appears on the right. Then enter your macro in the Long String Editor dialog box. Otherwise, enter the macro in the Macro text box. Start by writing out the combination of commands and options as you would enter them on the command line or in a script. Then add any necessary special characters.
Below are the special characters you need to know for menu macros:
| Character | Description |
| Space | Equivalent to pressing Enter except when entering text to create a text object that contains spaces (between words). Use between the command and its options. |
| ; (semi-colon) | Equivalent to pressing Enter. The end of a line in a menu macro is also equivalent to pressing Enter. More helpful than using a space when you need to press Enter twice, because it shows the number of Enters more clearly. Also helpful at the end of the macro. |
| \ | Pauses for user input, such as picking a point or entering a value. |
| + | At the end of a macro line, continues the macro to the next line |
| * | At the beginning of a macro, before ^C^C, repeats the macro until you press Esc or choose another menu item. |
| ^P | Toggles the display of the menu macro on the command line; makes the macro look neater when you use it. |

- From the Command List Categories drop-down list, choose Custom Commands to easily find your command. Select it and drag it to the desired menu or toolbar at the top of the Customize User Interface dialog box.
- If you drag it to a toolbar, use the Button Editor to give it an image. Usually, you choose an existing button to start with, click Edit, and modify it. Then click the Save As button to save the icon image.
- Click OK and try out your new command!
Related posts:



[...] For information on how to create a custom command, see this tip. What keyboard shortcuts do you use? Leave a comment! Please also explain what they do, in case it [...]
Hi,
How can I change the default behavior of Multiple Object Stretch command?
Meaning:
when I press the MOS command and hit enter or right click mouse button it executes defaults Crossing Window selection, but wish to go for a Crossing Polygon option. It’s annoying to keep entering CP or press down arrow keyboard button to select it over and over again since the CP option is the option I use most of the time.
It’s Acad 2012
Thx.
Are you just talking about the STRETCH command? I’ve never heard the phrase “Multiple Object Stretch,” although of course, you can stretch multiple objects with the STRETCH command.
I would simply create a custom command and assign it to a keyboard shortcut or add it as a button to a ribbon panel. I have instructions here: http://www.ellenfinkelstein.com/acadblog/tutorial-create-a-custom-command/. This might also help — http://www.ellenfinkelstein.com/AutoCAD_tips_create_custom_toolbar_cui.html — although it describes adding a button to a toolbar, rather than to the ribbon.
Dear Ellen,
Thank for your quick replay.
Yes, I meant the STRETCH command. “Multiple Object Stretch” is the tool tip displayed when you hover your mouse over the icon in “Modify” panel of the “Express Tools” tab. Also known as “Stretch Multiple”. Sorry for misunderstanding.
The reason i look to edit or modify existing commands is that I’m not very familiar with writing codes and programing and I find it easier to change just a bit of the existing code rather then write a new one.
See, when I open the CUI and look for “Multiple Object Stretch”, macro label shows “^C^Cmstretch”. Here I thought I can change that default behavior.
And the STRETCH command shows “$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_stretch,^C^C_stretch)”
so I don’t have a clue about where is the option of choosing Crossing Window or Crossing Polygon hidden.
Or to make it simpler, if you type “MSTRETCH” the command line shows:
Specify an option [CP/C]
This is what I meant. It goes for C by default and I want to make CP to be default, not to type CP every time.
When I wrote my question to you, i was already on http://www.ellenfinkelstein.com/acadblog/tutorial-create-a-custom-command/ so now I’ll give it a try with creating a custom command.
Anyhow, thank you for your time.
Solved. Not exactly what I want but does the trick and it’s fast enough.
After MSTRETCH long mouse right click and pick CP on a shortcut drop down menu. Good
hi.
cool tutorial.
i learn it but i have a question.
i make a new command and put it into one pallet but when i type it in command line, it dosn’t run anything.
is that normal?
i like to create some custome command that i can type them in command line.is there any way!?
(maybe i should use acad.pgp!)
thanks
You can’t exactly type the command, but you can create a custom keyboard shortcut, such as Shift+L. I have instructions at http://www.ellenfinkelstein.com/acadblog/create-a-custom-keyboard-shortcut/.
Hi I am trying to create a custom toolbar button that will turn on a layer. So i can just click that button and that layer turns on in the current drawing, instead of opening the layers manager to find my layer. How can I do that? Anybody have a suggestion? I have autocad 2004.
how to change the command copy rotate command to multiple mode
can i record steps as in excell?
Fantastic tutorial! Saved me hours of work, thank you.