An AppleScript to convert the clipboard to plain text

Sep 05, '07 07:30:00AM

Contributed by: mistersquid

Trying to convert RTF-formatted text on the clipboard to plain text is a nightmare. There are many solutions out there, some of which cost money, and others which are free but don't work reliably. So here's an AppleScript that will do the job:

  set the clipboard to string of (the clipboard as record)
on error errMsg
  display dialog errMsg
end try
Turn it into a run-only AppleScript, bind that AppleScript to a keyboard shorcut with a utility like Keyboard Maestro (my personal favorite), and never look back again. Note that the code above is adapted from the script "clip2pure_text" found at the bottom of this blog post.

[robg adds: In the comments to this older hint, an alternative method was provided -- just do a pbpaste | pbcopy, if you happen to be working in Terminal when you need this done.]

Comments (18)

Mac OS X Hints