Applescript to convert clipboard rich text to plain text

I struggled for months with copying rich text into the clipboard and then trying to paste it back out as plain text. I do this a lot when copying and pasting formatted text into text areas in certain websites, some of which are sort of aware of rich text (the end result is never what I want). Previously, I used my favorite text-only application, TextMate, as a cut 'n paste proxy to get plain text. I'd paste the RTF text snippet into a new document, and then copy it out again to paste into my final destination. This was clearly not very the best way to do things.

These days, I use a combination of Applescript and Quicksilver. I can convert the clipboard to plain text in a fraction of a second.

Here's the Applescript, which I found at

  set the clipboard to string of (the clipboard as record)
on error errMsg
  display dialog errMsg
end try

I compiled and saved this script as an executable. Using Quicksilver, I can invoke the script using the keyboard nearly instantaneously. Here's a video of me copying and pasting rich text, converting the clipboard to plain text, and then re-pasting. I pause for just a moment when invoking Quicksilver because otherwise, it would be impossible to see.

[flashvideo filename=videos/plaintext-quicksilver-demo.flv width=496 height=304 floatingcontrols=true /]

On another note, I'm really enjoying using SnapzProX to make all these movie screenshots. I'm using ffmpegx to convert them to Flash, and am displaying them in my journal with Flash Video Player plugin for Wordpress.