Macros and user input

Macros and user input

2
NewbieNewbie
2

    Nov 10, 2004#1

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

    Code: Select all

    InsertMode
    ColumnModeOff
    HexOff
    UnixReOff
    "typedef struct tst"
    GetString "Enter Structure name in lower case"
    "_tag
    {
    
    
    }tst;"
    The problem is that I want to insert the string into my macro twice without having to enter it twice.  Which feature do I need to use for this?

    Thank you,
    Doug
    8O

    6,686585
    Grand MasterGrand Master
    6,686585

      Nov 11, 2004#2

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

      Code: Select all

      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 contents are 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 delimiting characters.

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

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

      Finally the clipboard is set back to windows clipboard.

      Interesting: The status bar still shows C9 for user clipboard 9 after the macro finished 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?
      Best regards from an UC/UE/UES for Windows user from Austria