Skip to content

Posts tagged ‘paste’

23
Jan

Copying the Contents of Windows Dialogs

As a developer, I very often see error messages – some of those originate from the products I develop, and I have to report them as bugs. Whenever I get an error message in a dialog, I typically take a screenshot, and add that to the bug base issue. That’s fine, but it means people can’t search for that error message in the bug base – in order to enable that, I’d usually just manually type out the error message, rather than take a screenshot. That was before. Today, I’d just press CTRL+C to copy the error dialog contents.

That’s right, whenever you see a dialog in Windows, like this:

A typical Windows error message dialog.

You can press CTRL+C to copy, and then open up Notepad, and press CTRL+V to paste:

The dialog title, contents, and even the button text are saved to the clipboard.

I had no idea this was possible until I read a Lifehacker article explaining it.  Since I’ve started using it, I’ve found it very useful in my every day work. Maybe you will too!

Just a note, though – it doesn’t seem to work everywhere. For example, JavaScript alert dialogs can’t be copied in Firefox, but they can in Internet Explorer.

14
Aug

Converting Formatted Text from the Clipboard to Plain Text

Usually when I copy text from web pages, I really don’t want the formatting from the webpage to be kept. I  just want to have the text in the simplest format possible, and then I can set my own styles. Unfortunately, this isn’t normally how it works. Typically, when copying from a web page in a browser, it may also copy any tables, images, and styles that are applied to or mixed with the text. This does depend on where you are pasting the text, though. In my case, I use Microsoft Word most of the time. Word supports a lot of web page elements, meaning they will likely appear in the Word document.

Consider the following text:

This is some example text. You’ll notice that numerous styles are appliedwarning

Here are some bullet points:

  • One
  • Two
  • Three
    • Three Part 1
    • Three Part 2
  • Four

If I wanted to copy that text to Microsoft Word, here is what I’d see:

pastedtoword

Word is pretty good at keeping the formatting mostly intact; however, sometimes, this isn't desired.

The formatting is mostly intact. What if you didn’t want that? What if you just wanted plain text, and you wanted to choose your own styles from scratch? There is one way to do it from within Word (click the wordbutton1 button for these options), but I’ll show you how to do it without such a  feature. To achieve this, I paste the text into Notepad. Yes, Notepad – the simple text editor provided by Windows. Here’s what the text will look like, once pasted:

Notepad will remove formatting from any text you paste into it.

Notice how the image is gone, and all the styles are removed? Now you can copy this text instead, and paste it in Word:

pastedtowordplaintext

No more formatting!

No more styles, bullets, or image. You can now style it exactly as you want, without having to start off with the same formatting as the web page. This isn’t, perfect, though – you may have to make corrections to the plain text copy in Notepad, as the removal of the formatting sometimes leaves the text with improper indentation.

I’ve used this little trick in a few different scenarios. Here’s an example: Sometimes I include a quote from a website in my e-mails. The default format for my e-mails is rich text, but when I include something from another source, I really don’t care about formatting – I’ll set my own formatting to suit my e-mail. If I just copy paste the quote into my e-mail, it will include the formatting – this usually ruins the look of my e-mail. To prevent this, what I do first is use Notepad to destroy the formatting, and then paste the plain-text version into my e-mail.