Mining Good Old Plain Text
2 December 2008
When using various web-based tools to edit rich text I find I need to copy and paste snippets of web pages such as names, titles, links, and so on to ensure accuracy. Modern web applications with the help of current browsers actually allow the web page fragments being copied via the clipboard to retain their XHTML tags and formatting. In the vast majority of cases I only require the plain text to be pasted.
Very occasionally the web application has a menu option to copy just plain text from the clipboard. Of course the clipboard contents can always be copied into a text editor like Notepad, selected and copied again to allow the paste to consist of the plain text. We all know this is tedious when done repeatedly.
With Windows Live Writer, the bloggers friend, we find a close to perfect solution to our problem. However, some formatting such as a link is retained. Some time ago though I discovered a tip in a Lifehacker post that, given you are handy with Visual C# Express, allows you to build a ClipClean desktop application in minutes. I produce the C# code here with an additional line of my own:
static void Main()
IDataObject data = Clipboard.GetDataObject();
if (data != null && data.GetDataPresent(DataFormats.Text))
String clipboardText = data.GetData(DataFormats.Text).ToString();
Clipboard.Clear(); // Michael Rees addition
Add a shortcut to the resulting ClipClean.exe program to your desktop and assign a shortcut key (I use Alt-Shift-L). After you copy anything to the clipboard typing the shortcut key leaves only plain text in the clipboard which can be pasted in your application of choice. This is a big improvement but is an extra step to remember, has no visual feedback, sometimes loses focus from the application and occasionally stops working.
This last week I came across a much better free solution, PureText. It uses a single keystroke (Windows-V by default) to strip out the plain text and paste it in one. It lives in the System Tray and has options to allow different key shortcuts and whether paste is included or not. I thoroughly recommend it.