Using text macros

Create a text macro

A textmacro is a shortcut for a sequence of keystrokes. A macro can be simple—it can type a word or phrase you use often—or it can be complex, such as a formatted address. A macro code is the name of the text macro you create. For example, instead of repeatedly typing “Centers for Disease Control and Prevention,” you can create a macro code (such as “cdc”) that changes to the full name.

  1. Choose Window > Text Macros.
  2. If you want to create a text macro from existing text, select the text in the document.
  3. Choose New Macro from the Text Macros panel menu, or click the New Macro button  in the Text Macros panel.
  4. Enter a macro code in the Macro Code text box. Note that macro codes are case-sensitive.

    The code appears in the Text Macros list.

  5. For Macro Text, type the text string that you want entered when you activate the text macro.
  6. To include text attributes from the existing text when inserting or swapping macro text, select Remember Text Attributes.

    By default, inserted or swapped macro text uses the style attributes of the destination paragraph.

  7. To assign a keyboard shortcut for activating the macro, place the cursor in the Macro Key Shortcut text box, and press the keys you want to use for the shortcut.

    Shortcuts are especially useful if you turn off Automatically Swap Macro Text in the Text Macros panel.

    If the keyboard shortcut you want to assign to the macro is already assigned to another function, the alert symbol appears at the bottom of the dialog box with the message “Currently Assigned To: [function].” If you choose to assign the keyboard shortcut to the macro, the previous keyboard shortcut function is overridden.

  8. Click OK.

You can replace the macro code with macro text automatically while typing, by using a macro key shortcut, or by choosing Swap Macro Text from the Text Macros panel menu.

Edit a text macro

  1. From the list in the Text Macros panel, double-click the text macro you want to edit, or select it and click the Edit Text Macro button  in the Text Macros panel.
  2. Enter your changes in the text box, and click OK.

Duplicate a macro

Use the Duplicate Macro command to create a copy of an existing macro. The duplicate macro is assigned the same code as the original, but with a number appended to it, and is listed immediately after the original macro in the Text Macros panel. For example, duplicating the macro “DOT” creates a copy of the macro, named “DOT1.”

  1. Select the text macro you want to duplicate from the list in the Text Macros panel.
  2. Choose Duplicate Macro from the Text Macros panel menu.

Delete a text macro

  1. Select the text macro you want to delete from the Text Macros panel list.
  2. Choose Delete Macro from the Text Macros panel menu.

Opomba:

Once you delete a macro, you cannot undo the deletion.

Insert or swap macro text

You can insert macro text in three different ways: Using the Insert Macro Text command to insert macro text at the insertion point, having macro text inserted automatically while typing, or swapping existing text with macro text.

Insert macro text automatically

If Automatically Swap Macro Text is selected, macro codes are automatically converted to macro text while you type. For example, if you created a macro code named “cdc,” when you type cdc followed by a word-ending character such a space or period, Center for Disease Control and Prevention appears. The macro code is case-sensitive.

  1. Make sure that Automatically Swap Macro Text from the Text Macros panel menu is selected. (A check mark should appear next to it.)
  2. Type the macro code followed by a word-ending character (space, comma, period, or paragraph return).

Opomba:

If you want to restore the macro code text, choose Edit > Undo until the macro code reappears.

Insert macro text at the insertion point

The Insert Macro Text command places the selected macro text at the current text insertion point.

  1. Using the Type tool , click the location where you want to insert the macro text.
  2. Do one of the following:
    • Press the macro keyboard shortcut for the macro you want.

    • Select the macro you want from the Text Macros panel, and choose Insert Macro Text from the panel menu, or click the Insert Macro Text button .

Swap text with macro text

The Swap Macro Text command searches the text immediately preceding the current text insertion point for any defined macro code (case-sensitive) and, if one is found, removes the macro code and replaces it with the associated macro text. For example, you have created a text macro for Centers for Disease Control and Prevention, and the macro code is CDC. To use the macro, type The CDC, and then with the text insertion point placed immediately following the macro code, choose Swap Macro Text. InCopy then searches the text immediately preceding the insertion point and replaces CDC with the macro text Centers for Disease Control and Prevention.

  1. Using the Type tool , click to the immediate right of the macro code that you want to replace, or select the text you want to replace.
  2. Choose Swap Macro Text from the Text Macros panel menu, or choose Edit > Swap Macro Text.

Opomba:

The Swap Macro Text command does not continue to search the entire document for every occurrence of the macro code. To find and replace all instances of a word or phrase, use the Find/Change command.