Any time the user types zpi, it will expand to: 3.14159265.
2. Here is a more complex example. It’s a TextExpander fill-in snippet which tells the user their zodiac sign:
zodiacSigns = ['monkey', 'rooster', 'dog', 'pig', 'rat', 'ox', 'tiger', 'rabbit', 'dragon', 'snake', 'horse', 'goat']; var index = %filltext:name=Enter your birth year:default=1984% % 12; "Your Zodiac sign is the " + zodiacSigns[index] + ".\n"; // %filltop%
When expanded, the user is prompted for their birth date, and the snippet returns their zodiac sign. For example, if the user enters 1972, the snippet expands to “Your Zodiac sign is the rat.”
Did you notice %filltop%? That tells TextExpander to duplicate any single line and popup fields at the top of the fill-in window and hide the script. You’ll find that via the insert menu under Fill-ins > Show at top.
ignoreOutput – do not use the final statement as the expansion [boolean, read/write]
appendOutput(text) – add text to the expansion [function]
baseDate – date and time at which the snippet is expanded [date, read only]
adjustedDate – date and time used to expand the snippet [date, read/write]
pasteboardText – clipboard contents [string, read/write]
expansionContext – bundle ID within which snippet is being expanded [string, read only; can be nil]
filledValues – fill-in field values [associative array of strings, read/write]
Here is a JSA script to create a new message, set its subject, and set its content: