Macro help

Macro help

mmcdaniel38EP3
Explorer Explorer
812 Views
8 Replies
Message 1 of 9

Macro help

mmcdaniel38EP3
Explorer
Explorer

I'm trying to make a custom button, but can't seem to select a previous object.

 

What I'd like to do is use chprop to change a selected text color to 2 (yellow) then edit the text. Doing it in the reverse order would also be fine, just as long as the button lets you select text, lets you edit the text and makes it yellow.

 

Any help would be appreciated. Also, does anyone know how to assign a macro to a key combo or command? Lisp isn't an option as this is AutoCAD LT.

0 Likes
Accepted solutions (2)
813 Views
8 Replies
Replies (8)
Message 2 of 9

pendean
Community Legend
Community Legend
How do you do what you want at the commandline only? Be detailed in your response.
0 Likes
Message 3 of 9

mmcdaniel38EP3
Explorer
Explorer

chprop

enter

(select object)

c

enter

2

enter

enter

select

enter

p

enter

enter

textedit

0 Likes
Message 4 of 9

pendean
Community Legend
Community Legend
Translation to a macro where a semi-colon is <enter> and the slash is pause to select (untested, just off the cuff using your sequence), with ^C twice to cancel any running command or selection before it all starts...

^C^C_chprop;\;_c;2;;\;p;;_textedit

Syntax explained in HELP https://knowledge.autodesk.com/support/autocad-lt/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/Au...
And overview of Macro writing in HELP starts here https://knowledge.autodesk.com/support/autocad-lt/learn-explore/caas/CloudHelp/cloudhelp/2019/ENU/Au...

0 Likes
Message 5 of 9

mmcdaniel38EP3
Explorer
Explorer
Sorry, that didn't work. I'm not too bad with making macros myself, but I just can't seem to get this. If you can run it from a button and test another solution I'd greatly appreciate it. Thanks!
0 Likes
Message 6 of 9

pendean
Community Legend
Community Legend
Oh well, so much for that 😉
0 Likes
Message 7 of 9

pgander
Explorer
Explorer
Accepted solution

The TEXTEDIT command prompts for a point or LAST to make a selection. You cannot use PREVIOUS.

If PICKFIRST is 1 and PICKADD is 2 you can simulate pre-selecting an object in a macro by preceding the SELECT command with ^r. This forces the macro to use the newer version of SELECT which honours the PICKADD setting rather than the legacy version which does not.

Try the following macro:

^c^c^r_select;$m=$(if,$(getvar,cmdactive),\)_chprop;_color;2;;^r_select;_previous;;_textedit

The diesel part checks whether an object was selected before the macro was called and pauses for input if not.

Alternatively your macro could make a copy of the text, erase the original and then use TEXTEDIT;LAST

Message 8 of 9

mmcdaniel38EP3
Explorer
Explorer
Thanks, this works like I need it to!
Any tips on assigning a button to a command alias in LT? The best I can find is a key combo like Ctrl+t. I'd like it to not require the combo and just be a single key.
0 Likes
Message 9 of 9

pendean
Community Legend
Community Legend
Accepted solution
@mmcdaniel38EP3 LT does not allow macros to be typed command aliases/shortcuts: all part of the discounted pricing that is LT. Combos is it.