Display full version of the post: keyboard shortcut code

SONGS
02.05.2008, 18:06
Hi again. If the help files were more helpful I wouldn't keep asking you nice folks so many questions.
 
I'm using AutoCAD 2007. I would like to Record a macro but there doesn't seem to be that option. (I see I can write my own however.)
 
So in lieu of that Id like to create a couple of keyboard shortcuts.
 
One, I'd like to set Ctrl+W to do the following menu choices:
 
go to Tools\Named UCS... then select World, choose Set Current, click OK. Then go to menu View\3D Views\Plan View\Current UCS
 
And 2, I'd like Ctrl+Shift+W to go to:
 
Tools\Named UCS... select Called North View, choose Set Current, click OK. Then go to menu View\3D Views\Plan View\Current UCS
 
Problem is that I don't know how to write the code properly in the Tools\Customize\Interface box to make it work.
Any suggestions?
Thanks.

Vladimir Michl
02.05.2008, 21:17
The "macro recorder" function was introduced in AutoCAD 2009.
You can assign almost any keyboard shortcut to a user macro. The macro can be defined exactly the same way as you type the command and its options on the commandline - e.g. _UCS _World

SONGS
02.05.2008, 21:27
I've tried that. It tells me it's an unknown command in the macro mode. On the command line it works but only shifts the X-Y axis lines, it doesn't change the view of the map.
 
The way I wrote the steps in the first note is what I normally have to do to change views. It's a bit cumbersome hence my reason for wanting a shortcut.

SONGS
02.05.2008, 22:03
Is there somewhere in the help files where it tells the syntax of writing a macro? And the allowed codes and commands used in a macro?

Vladimir Michl
02.05.2008, 23:38
A macro is just a plain string of the same characters you would type in the command line. No special codes, no special commands.

RichardBlank
03.05.2008, 16:52
[QUOTE=Vladimir Michl]
The "macro recorder" function was introduced in AutoCAD 2009.
You can assign almost any keyboard shortcut to a user macro. The macro can be defined exactly the same way as you type the command and its options on the commandline - e.g. _UCS _World[/QUOTE]
 
Thank you for the helpful information Vladimir . I was having issues as well.
 
 
Richard
 
 
.

SONGS
05.05.2008, 15:13
Ok, but I've seen that things like semicolons mean the code does one thing while a backslash does another and a colon does yet another. So it seems there might be more than just "a plain string of the same characters you would type in the command line. No special codes, no special commands" that one must know. There are things that you can do that I can't find in the help files. (I know, it's silly of me to think the help files are there to actually help.  )
 
And some things I can do from the keyboard don't seem to work all the way in a macro. For example, here's a bit of code that works part-way:
 
^C^C_ucsman 0;alt+V;alt+3;alt+P;alt+C;
 
It seems to work ok until it gets to alt+C, then it says alt+C is an unknown command. Alt+V is the View menu, alt+3 is the 3D Views option, alt+P is the Plan View option and alt+C is the Current UCS option. It all works from the keyboard but not the macro. And I'm assuming the ";" means Enter?
 
And while the above code is shorter than doing it all manually, I'd still like to find a way to automate the input from the _ucsman 0 box also. I do a lot of switching between 'World view' and our 'Called Plant North' view. So if I could do it all from one keyboard shortcut, like Ctrl+Shift+W, it would save a lot of time.
 
Thanks again for any input.

Vladimir Michl
05.05.2008, 15:21
For plain command sequences it is like that - no special commands, no special codes. As an added value, you might replace <ENTER> by ";" and you can break the macro execution with "\" to wait for user input. And yes - in those rare situations where you would use a Ctrl-key combination in AutoCAD, you type "^" in macros (e.g. ^C).
 
Plus there is a macro language called Diesel where you can use conditional statements, simple string and arithmetic operations, etc.

SONGS
05.05.2008, 16:24
Ah, I see. I guess the only other thing then is, can you tell me why, in the code
 
^C^C_ucsman 0;alt+V;alt+3;alt+P;alt+C;

the alt+C doesn't work? The rest seems to work but not that. TIA

Vladimir Michl
05.05.2008, 21:48
"alt+C" is nothing more than "a", "l", "t", "+" and "C" keys as typed...
You cannot control dialogs from menu macros.