I am writing a book and trying to add a service to provide syntax highlighting to text selected in Pages with Automator. I have a service accepts selected text and runs it through a shell command (pygmentize) which converts it to syntax highlighted RTF.
The problem is that when the text is returned, Automator treats it as plain text and I get gibberish back. I've tried changing the accepts back and forth between rich and plain and it doesn't make any difference. I've tried piping the output through textutil to no avail.
My only work around for now is to have the shell command copy to the clipboard with pbcopy and then use an Automator to grab the contents of the clipboard. I'd rather find a way to do this without having to wipe the clipboard, any suggestions for getting Automator to treat my shell commands output as rich text?
Is there anyway to make this work with AppleScript?