Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to create HTML tables in Mail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to create HTML tables in Mail
Authored by: lar3ry on May 15, '07 11:49:22AM
Very interesting technique. I never considered this, and wondered why Mail.app was so obstinate about the limited RTF it will accept as input.

I think that any "text to html" shell utility/script would do. For instance, I use a text formatter I wrote called "fmt.pl" (written in Perl) to "standardize" text that I write, and to convert from the shorthand text that I use for writing to various formats such as XML and HTML for presentation.

This hint has the start of something very useful...!

So, now my next move is to create a single AppleScript to automate all of this. A lot of the following is already in the script from this hint, but it should be packaged a bit more concisely:

  • Copy text from Mail.app
  • Feed it to a special shell script that does the following:
    • Use pbpaste to get the text
    • Use iconv to convert to ISO-8859-1
    • Pass it through "fmt.pl -H" to generate HTML (or whatever text to HTML utility that is desired)
    • Use textutil to convert the HTML to RTF
    • Use pbcopy to store the RTF text into the copy/paste buffer
  • Tell Mail.app to replace the contents of the message with the paste buffer.

Finally, I can then bind this AppleScript to a keystroke using the free Mail Act-On, so all I need to do is type my text in the short hand that I use for writing, and then press my special key to get it nicely formatted within Mail.app!

[ Reply to This | # ]