AppleScript and Shell Script Snippet Issues in TextExpander 3.3

A couple of unfortunate issues have cropped up in the recently-released TextExpander 3.3. We wanted to make you aware of them and offer workarounds.

AppleScript Snippets
If you create a new snippet and set it to AppleScript, TextExpander 3.3 still treats the new snippet as a text snippet. When you expand it, the result will be the content of the AppleScript, not the script results. Any AppleScript snippets you created in earlier versions are still treated as AppleScript snippets.

As a workaround, you can duplicate an existing AppleScript snippet and then edit its contents.

Apple Script and Shell Script Snippets and “%”
This issue with shell script and AppleScript snippets involves the % (percent) symbol. TextExpander has always used % to delimit macros. In a script snippet,  TextExpander 3.3 is treating the % as a macro delimiter, which allows you to embed snippets within script snippet source code, but this has the unfortunate side effect of misinterpreting occurrences of ‘%’ as a character.

One workaround is to use 2 percentage signs (%%) to “escape” the % character (TextExpander power user @drdrang posted more about this on his blog), but this is inconvenient and does not work if the script snippet itself is embedded within another snippet.

If you use script snippets a good deal, you may want to consider reverting back to TextExpander 3.2.4. We do apologize for the aggravation and we hope to release a fix shortly in TextExpander 3.3.1.

9 Responses to “AppleScript and Shell Script Snippet Issues in TextExpander 3.3”

  1. Iikka says:

    It’s a feature as much as a bug. This allows me to do (what i’ve wanted to do for a long time) shell snippets like:

    #!/usr/bin/perl
    print “All work and no play makes Jack a dull boy. ” x %fill:x% ;

    (OK, this is a poor example, but you get the idea.)

    When you fix this “bug”, please retain some way to put input to shell scripts. The double-percent-escape is fine for me (it should work while embedded, of course).

    Iikka

  2. Simon says:

    Hi – just checking, as we’re now on 3.3.4 and going by my test today the bug is still there. Any revised ETA for a fix?

    Thanks

    S

  3. Greg says:

    Hi @Simon. The bug is fixed. If you simply copy and paste @likka’s example, it will fail, but that’s because the example includes invalid characters. Here’s a better example, which I’ll try to format so that you can copy and paste:

    #!/usr/bin/perl

    print "All work and no %fill:word% makes Jack a dull boy.\n";

  4. Simon says:

    I’m an idiot. I completely missed the “Content:” setting up the top of the window.
    my non-woking script was set as a Plain text item, not a shell script. Changing it “fixed” the “bug”.

    Sorry!

  5. Roman says:

    I’m trying to set up a ruby shell script whicht takes an adress from the clipboard reformats the string and inserts “%key:tab%” commands for TextExpander. The goal is to automatically fill out a form in Firefox.

    Essentially the output of the script is as follows:

    tab = “%key:tab%”
    text_expander = vorname + tab + nachname + tab + firma + tab*2 + anschrift + tab + plz + tab + ort + tab*4 + telefon + tab*2 + email

    The Problem is, Textexpander does not interpret the “%key:tab%” portion of the string correctly. What am I doing wrong?

  6. Greg says:

    I suspect TextExpander doesn’t handle key presses in shell script results. That seems like a reasonable feature request, so I’ll file it as such. In the meantime, you can work around it by “wrapping” your script snippet results in a plain text snippet. For example, let’s say your script’s abbreviation is OONE. Create a new plain text snippet named TTWO and set its contents to %snippet:OONE%. The TTWO snippet will first run the OONE shell script snippet, then it will interpret the results and do your tabbing as you expect. If you have further trouble, please write us with specifics to support@smilesoftware.com.

  7. Roman says:

    Thanks Greg!!

    Your workaround does the trick :)

  8. Hi all.

    Has the first issue actually been fixed? I am using the most up to date release of TextExpander and my AppleScripts are still only returning the contents of the script and not the results.

    Any help?

  9. Greg says:

    Yes, the first issue has been fixed. You can confirm this by making a new snippet, setting the Content: to AppleScript using the popup over the snippet editor, setting the snippet to a super-simple script such as: return “Hello”, then setting the abbreviation. Switch from TextExpander to an application into which you can enter text, such as TextEdit, then type your abbreviation.

    If your AppleScript snippet does not compile properly or encounters an error, then indeed the script itself will be what gets expanded. If there’s error information TextExpander can write to the Console, it does. Often this information is not clear. Generally, if you can get your script to run in Script Editor first, then it should run when copied and pasted into TextExpander, provided you’ve set the Content: to AppleScript.

    If you’re having further trouble, please contact us for fast and friendly support.

Leave a Reply