TextExpander logo TextExpander Smile logo
 

Help: Advanced Snippet Functions: Macros


What is a Macro?

In the context of TextExpander, a macro is a short code that begins with a percent sign (%). That code is like a placeholder for information you want to insert in your snippet, like today's date or someone's name. When a snippet that contains a macro is expanded, that code is replaced by the information you specified.

TextExpander provides several different macro options to choose from. These macros are accessible in the TextExpander window through the Insert menu new snippet button located just above the Abbreviation box.

Note: Since TextExpander uses the percent sign (%) to indicate a macro, it will not appear in the expanded snippet text. In order for it to appear in the expanded snippet, it will need to be doubled (%%). For example, if you want your expanded snippet text to be “50% discount”, enter it as “50%% discount”.

Date / Time Snippets

Insert the current date or time with a snippet. Or use date/time math to add a past or future date/time, e.g. the date five days from now. For a full explanation, see Date, Time, and Math Macros.

Clipboard

    %clipboard

Have your clipboard contents included as part of your snippet upon expansion. For example, say you want to customize just one portion of a form letter.

  1. Create a snippet with content:
    • Hello %clipboard,

      It was a pleasure meeting you! Thank you for coming.

      Cheers,

      Ann

  2. Copy something to the clipboard (Command + C), in this case "Bob".
  3. Type the snippet abbreviation. It will expand:
    • Hello Bob,

      It was a pleasure meeting you! Thank you for coming.

      Cheers,

      Ann

Fill-in Fields

Inserts custom fields into your snippets that can be filled in while expanding the snippet; useful for form letters, e.g. "Dear ____, Thank you for the ____." For a full explanation of these macros, see Creating and Using Fill-in Fields.

Posición del cursor

    %| = (Shift + \) Posición del cursor AQUI

Especifica dónde deseas que el cursor aparezca después de que el fragmento sea expandido. (El cursor de inserción aparece al final del fragmento de forma predeterminada).

    %\ = Seleccione hasta aquí (debe aparecer después de %|)

En combinación con %|, esto especifica un intervalo de texto para ser seleccionado en el fragmento de código después de la expansión.

Movimiento del cursor

    %> = cursor derecha

    %< = cursor izquierda

    %^ = cursor arriba

    %v = (letra v) cursor abajo

En casos donde tu editor pueda añadir automáticamente una sangría a tu fragmento, o por otras razones, puedes especificar con los movimientos de las flechas arriba, abajo, izquierda y derecha para que se lleven a cabo luego de la expansión, relativo al final del fragmento. Estos códigos deben ir al final del fragmento, y TextExpander Los procesará en orden inverso. No se pueden utilizar en combinación con %| o %\.

Anulaciones delimitadoras

    %+ = mantener delimitador

    %- = abandonar delimitador

Estos códigos delimitadores anulan el Preferencias > Expansión > Expandir abreviaturas configuración. Estos códigos deben ir al final de los fragmentos (después del Movimiento del cursor).

Key Presses

    %key:tab%

    %key:esc%

    %key:return%

    %key:enter%

Insert the equivalent of the press of a key into a snippet. Available key options are Enter, Escape, Return and Tab. This is useful for web forms where a single snippet can fill in a field, tab to the next field, then submit the form with the Enter key. Also, useful in emails where you want one snippet to fill in the Subject line then tab to the email body and fill it in. That snippet might look like this:

email example

Nested Snippets

    %snippet:<snippet abbreviation>%

    (where <snippet abbreviation> is the abbreviation assigned to the snippet you would like to nest.)

Nest a snippet within another snippet. For example, you might want to use your telephone number snippet in your email signature snippet. If your telephone number changes, you only need to update one snippet. Here is a telephone number snippet (ttel) nested in an email signature snippet (ssig):

    ssig =

      Ciao,

      Lisa

      ---

      Lisa Newton

      Acme, Inc.

      lisa@acme.com

      %snippet:ttel%

    The snippet will expand to this:

      Ciao,

      Lisa

      ---

      Lisa Newton

      Acme, Inc.

      lisa@acme.com

      1-408-996-1010

Nested snippets also work with AppleScript Snippets and Shell Script Snippets.


 
 
© 2006-2014 SmileOnMyMac, LLC, dba Smile. All rights reserved.
TextExpander is a registered trademark, Smile and the Smile logo are trademarks of SmileOnMyMac, LLC, dba Smile.