Subject: Using macros in .cui files

Macros in .cui files can run commands with custom options for tool palettes, menus, the ribbon (for versions that have a ribbon), toolbars, keyboard shortcuts, and aliases. For example:

^C^C^CZOOM;E;QSAVE;QPRINT

This example zooms to extents, saves the file, and then prints the file.

You can add macros to .cui files manually using a text editor and also in the Proper­ties area of the Customize dialog box. For example, to add a macro to a menu item, see Setting properties of menu items.

The following table describes special characters that can be included in macros that are used in .cui files.

Character

Description

;

^M

Equivalent to pressing the Enter key. For example, adding ; or ^M advances to the next prompt:

_DRAWORDER;_BACK

_DRAWORDER^M_BACK

^C

Equivalent to pressing the Esc key. Adding three ^C (Ctrl+C) characters before a command cancels any active commands or dialog boxes. For example:

^C^C^C_LINE

Note that ^C is ignored if used outside of a command; it doesn't clear the selection.

^

Equivalent to pressing the Ctrl key. Adding a carrot before a character runs the equivalent shortcut, for example, to toggle entity snapping on or off:

^B

^^

Suppresses the display of all prompts and input for the subsequent command.

^Q

Suppresses the display of all prompts and input for all subsequent commands.

blank space

Equivalent to entering a space, for example, a blank space between commands is the same as pressing the Spacebar or the Enter key.

.

Accesses the original or default command if it was undefined using the Undefine command. For example:

.LINE

_

Uses the default English translation for subsequent commands and options. This allows the macro to run on all languages. For example:

_ARC

-

Runs the command line version of the command instead of the dialog box version. This is useful when running commands in scripts. For example:

-BOUNDARY

Runs the command transparently, i.e., within a running command. For example:

_LINE;\_’COLOR

*

Repeats the subsequent command or entire macro until another command is run or the user cancels it. For example:

*CIRCLE

=*

Displays the current top-level user interface item.

$

Starts a DIESEL routine. For example:

$M=$(getvar,cmdnames)

@

Inputs the coordinates of the previously specified point. For example:

_CIRCLE;@_DIAMETER3

^B

Turns snaps on or off by toggling the SNAPMODE system variable. For example:

^B_CIRCLE;

^F

Forces a cancel. Can be used outside of a command to clear a selection.

^E

Sets the isometric plane to the next option (Top, Right, or Left) by setting the SNAPISOPAIR system variable. Equivalent to F5 and Ctrl+E.

^G

Turns the reference grid on or off by toggling the GRIDMODE system variable. Equivalent to F7 and Ctrl+G.

^O

Turns orthogonal mode on or off by toggling the ORTHOMODE system variable. Equivalent to F8 and Ctrl+L.

^P

Turns menu echo mode on or off by setting the MENUECHO system variable.

^T

Turns tablet mode on or off by toggling the TABMODE system variable.

^V

Activates the next viewport which affects the CVPORT system variable.

Using_macros_in_cui_files
© Copyright 2023. BackToCAD Technologies LLC. All rights reserved. Kazmierczak® is a registered trademark of Kazmierczak Software GmbH. Print2CAD, CADdirect, CAD.direct, CAD Direct, CAD.bot, CAD Bot, are Trademarks of BackToCAD Technologies LLC. DWG is the name of Autodesk’s proprietary file format and technology used in AutoCAD® software and related products. Autodesk, the Autodesk logo, AutoCAD, DWG are registered trademarks or trademarks of Autodesk, Inc. All other brand names, product names, or trademarks belong to their respective holders. This website is independent of Autodesk, Inc., and is not authorized by, endorsed by, sponsored by, affiliated with, or otherwise approved by Autodesk, Inc. The material and software have been placed on this Internet site under the authority of the copyright owner for the sole purpose of viewing of the materials by users of this site. Users, press or journalists are not authorized to reproduce any of the materials in any form or by any means, electronic or mechanical, including data storage and retrieval systems, recording, printing or photocopying.