AppleScript and Shell Script Snippet Issues in TextExpander 3.3
Posted 04/25/2011 by Greg
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.
Comments
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
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
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/perlprint “All work and no %fill:word% makes Jack a dull boy.\n”;
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!
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?
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.
Thanks Greg!!
Your workaround does the trick