Run a command macro from another command macro

Run a command macro from another command macro

Anonymous
Not applicable
1,693 Views
6 Replies
Message 1 of 7

Run a command macro from another command macro

Anonymous
Not applicable

Fairly new to CUI customization. I've written 3 different command macros in the CUI editor. I'd like to create a 4th macro that runs all 3 at once. Is that possible using simple command macros?

0 Likes
Accepted solutions (1)
1,694 Views
6 Replies
Replies (6)
Message 2 of 7

pendean
Community Legend
Community Legend
Are you in the LT version of AutoCAD? or in full AutoCAD?
Post the code for the three macro and provide an explanation for this 4th one please.

0 Likes
Message 3 of 7

Anonymous
Not applicable

I'm using full autocad 2019. I'd rather not get into specifics, but basically I'm writing macros to create layers that I'd like to use in other macro commands. The main purpose is so that if I need to change the properties of the layers, I only need to change them in the original layer commands and not every other command that calls on them.

0 Likes
Message 4 of 7

cadffm
Consultant
Consultant
Accepted solution

Then use SCRIPT files.

In your macro you can call the script,

if needed, you change the script content.

 

 

 

 

Sebastian

0 Likes
Message 5 of 7

pendean
Community Legend
Community Legend
Top secret, huh? or is this a fear of finding a better way to write your code? No one cares how great or not you are at coding, you asked for help and best way to do that is to let us see the code. You're doing great already.

Otherwise... a macro is code you drop in CUI behind a button on screen to activate. Is that what you mean by a macro?
There is no "run these three buttons over here" option in AutoCAD.

If you don't want help rewriting three macros into one or converting them to LISP, you'll have to explore using all script files instead https://cadanswers.com/question/how-do-you-create-an-autocad-script/

Good luck.
0 Likes
Message 6 of 7

Anonymous
Not applicable

Thanks for the advice. Looks like I'll need to study scripts now.

0 Likes
Message 7 of 7

Sea-Haven
Mentor
Mentor

If you make your macros into defuns then you can daisy chain as many as you like. I use (if (not mydefun)(load "mydefun.lsp"))

 

(macro3)(macro1)(macro2) and so on. even (macro3)(load "mydefun")(c:mydefun) 

0 Likes