April 24, 2011 at 10:31 PM by Dr. Drang
Anyone else unable to run @TextExpander shell snippets? Something weird is going on here.
I did a little testing and found that some of my shell snippets1 worked, some didn’t. I sent off an email to Smile support with the code from one of the failed snippets along with the error messages that appeared in Console.
Smile sent back a reply later that morning suggesting that the problem was with the percent symbols in my script. In normal snippets with plain or formatted text content, TextExpander uses % to delimit macros—%Y for the year, %B for the month name, %| for the final cursor position, etc. Apparently TextExpander was trying to interpret the percent symbols in my scripts as macros. Since they weren’t intended to be interpreted that way, they were generating the errors. Support suggested I double the percents (%%), which is TextExpander’s special macro for a single percent.
It worked. This is not a permanent solution, just a workaround until Smile fixes the bug (macro expansion is not supposed to happen in shell scripts). When the fix comes out, I’ll have to go in and change the double percents back to singles. I made a note to myself of which snippets will need to be changed back.
So if you have shell snippets that used to work but have been failing since the 3.3 update, look through their source for percent symbols. Doubling them will probably get those snippets working again. You may need to restart TextExpander after editing the snippets.
The percent bug applies to AppleScript snippets, too. I guess none of my AppleScript snippets have a % in them they’ve all been running fine. There’s an additional bug that prevents newly created AppleScript snippets from being interpreted at all—the source code itself gets inserted instead of the output. This bug doesn’t affect AppleScript snippets made before the update, only new ones.
Smile’s blog has a complete rundown of the bugs along with ways to work around them. Theres also a link to TextExpander 3.2.4 if you want to revert as you wait for these bugs to get fixed in 3.3.1.
This is, I’m sure, quite embarrassing to Smile. TextExpander 3.3 was introduced with much fanfare for its new features, and it’s a shame some things got broken in the update. I have to say they’ve been very upfront about the bugs, and I suspect we’ll see a fix coming out soon.
Shell snippets are snippets that replace the abbreviation with the output of a shell (or Perl or Python or Ruby or …) script. ↩