Quote:I'm confused, if the string from the 'codify' code note turns up without enclosing quotes, why not add them in AppleScript** without using the extra text file?
See
this post. Lest it be marginalized as overkill or something that might confuse later readers, let me say that the script there is nothing fancy, just something eminently practical for bringing linked DEVONthink material into Tinderbox without a lot of fiddling, and is based directly on your valuable contributions.
Note that the script there does in fact "run the sed in shell script and simply pass it the string to be cleaned as a script parameter."
Because it's AppleScript, and as far as I can tell there is no equivalent of the two-argument form of
runCommand(), the script there uses the
AppleScript-friendly form of your
quotify sed. Try putting your
quotify sed directly in an AppleScript (surrounded by quotes, of course) and I think you'll find that, as on my machine, it throws off an error because it needs to be escaped. I got miserably lost in the
sed picket fence trying to add backslashes in the appropriate places.
Then I stumbled on an easy, practical solution. I put your
quotify, which I knew worked in Tinderbox's two-argument form of
runCommand(), in a text file and read the file into AppleScript as described in reply #6 above (at least it's "above" as I write this

). I noticed an escaped form of
quotify in the AppleScript editor result panel and pasted that into the appropriate place in the DEVONthink script to be fed into the
do shell script statement. AppleScript Editor accepted it! I could then discard the unneeded external text file. Problem solved for me.
... Of course those with true prowess with
sed may enjoy going in manually and spending time mucking around. But that's not for me, and in case there are other general users like me who are learning a little AppleScript to do useful things and occasionally need a
do shell script there to get stuff into Tinderbox, I thought I'd share a practical tip.
BTW, I found quite a bit on the net about converting curlies to straight quotes, but your
quotify is the only reliable method I've found for going the other way. The AppleScript-friendly version of it has been helpful in solving perplexing problems that I was having when putting tab-separated-data tables on the clipboard for pasting into Tinderbox, which I've found a supremely efficient way for getting data into Tinderbox since it creates new notes automatically, complete with the appropriate attributes, etc. Thanks.