PDA

View Full Version : macro with choices


mliszkie
06-06-2003, 01:48 PM
I am trying to write a macro that will allow for single key strokes similar to acad.

Here is what I have:

DEFINE Z
LOCAL Choices
LOCAL N
LOCAL F
LOCAL L
READ '[New\Fit\Last]' Choices
WINDOW TWO_PTS (N)
WINDOW FIT (F)
WINDOW LAST (L)
END_DEFINE

This will run only the first ME10 default command...in this case WINDOW TWO_PTS.

How do I defien N,F, or L as the next req'd keystroke to run the seperate WINDOW commands??

Thom Ivancso
06-06-2003, 04:17 PM
Try to see if this is what you are thinking about doing.

DEFINE Z
LOCAL Choices
LOCAL N
LOCAL F
LOCAL L
READ LITERAL '[New\Fit\Last] - Enter N, F, L ...' DEFAULT 'N' Choices
{ The following checks if the correct literal was entered }
IF ( ( STR Choices <> 'N') AND ( STR Choices <> 'n' ) AND
( STR Choices <> 'F') AND ( STR Choices <> 'f' ) AND
( STR Choices <> 'L') AND ( STR Choices <> 'l' ))
BEEP
DISPLAY 'Error - Literal character not recognised'
READ LITERAL 'Re-enter N, F, L or n, f, l, ... (in quotes)' Choices
END_IF

IF (( STR Choices = 'N') OR ( STR Choices = 'n'))
WINDOW TWO_PTS
ELSE_IF (( STR Choices = 'F') OR ( STR Choices = 'f'))
WINDOW FIT
ELSE_IF (( STR Choices = 'L') OR ( STR Choices = 'l'))
WINDOW_LAST
ELSE
READ LITERAL 'Re-enter N, F, L or n, f, l, ... (in quotes)' Choices
END_IF
END_DEFINE


Cheers
Thom