Run Applescript/Run Shell Script output not "Text"

Hi all… I started playing with Automator a couple days ago, and I really liked the idea of using workflows as a way to package up scripts I had that were pieced together in a couple languages. As in, use applescript to gather some data, and then use perl to format it.

Anyway, I almost immediately hit the issue that the “Run Applescript” and “Run Shell Script” actions are kind of wishy-washy about the type of their outputs. Especially the applescript one, which returns “Anything”. I quickly found out that you can’t pass applescript output to, for example, “New Mail Message” and have it recognized as the text that I know it is!

Well, if you are interested, the whole investigation and solution I found is outlined here: Before I was done, I ended up implementing a two-line custom action, just so I’d have a way to tell Automator to expect Text output. It’s like a type-ifying pass-through for script output, which is nice, because I can insert in the chain whenever I need to force srcipt output to text. The link I gave also lets you download the action, and the XCode project for it, if you want.

Anyway, I thought lots of experienced scripters trying out automator might hit this problem, so I’m sharing. Also, if there was a much easier solution that I didn’t know about, I’d like to find out.