macros and user input.

Help with writing and playing macros

macros and user input.

Postby dougrilee » Wed Nov 10, 2004 2:02 pm

I am writting a simple macro which prompts the user for a name and them files in the appropriate blanks.

InsertMode
ColumnModeOff
HexOff
UnixReOff
"typedef struct tst"
GetString "Enter Structure name in lower case"
"_tag
{


}tst;"


Problem is that I want to insert the string into my macro twice without have to enter it twice. Which feature do I need to use for this?

Thank you,
Doug
8O
User avatar
dougrilee
Newbie
 
Posts: 2
Joined: Wed Sep 22, 2004 11:00 pm
Location: Yorktown, Virginia USA

Re: macros and user input.

Postby Mofi » Thu Nov 11, 2004 6:07 am

You have to copy the entered string to clipboard and paste it whereever you want.

InsertMode
ColumnModeOff
HexOff
UnixReOff
Clipboard 9
" "
GetString "Enter Structure name in lower case"
" "
Key LEFT ARROW
SelectWord
Cut
Key DEL
Key BACKSPACE
"typedef struct tst"
Paste
"_tag
{


}tst;"
Clipboard 0

This modified macro now changes the clipboard to user clipboard 9, so the windows clipboard content is not destroyed.

Then it inserts a single space, followed by the user entered string and an additional space. The entered string is now a single word, if it doesn't contain word deliminating characters.

Next it sets the cursor back to the end of the enterd string, select and cut it. Then the surrounding spaces, entered by the macro are removed.

Now you can paste the user entered string whereever you want.

Finally the clipboard is set back to windows clipboard.

Interesting: After the macro has finished, the status bar still shows C9 for user clipboard 9, although the windows clipboard is set and the status bar should display C0. I have V10.10c. Does this also happens in the new V10.20c?
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4039
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Macros

cron