Traver REALbasic for Windows: The Blog

REALbasic discussion and programs specifically for Windows (and some discussion of differences between REALbasic and Visual Basic).

Sunday, May 07, 2006

Paster: Another Windows Clipboard Utility

Years (a decade?) ago I wrote in Visual Basic a Windows clipboard utility called "Paster." At some point in time, Paster stopped working, and I don't know what caused the change, although it may have been caused by a change in a later version of Windows.

Paster was, however, a useful utility. (Shouldn't all utilities be that by definition?). Basically it was an always-on-top window that had a small footprint and here's what the program did: You could be working with a different program (e.g., WordPad), click on "Paster" to paste some boilerplate text into whatever you were working on with a mouse-clip or two. "Paster" not only pasted in the selected boilerplate text, but also restore the focus back to the program with which you were working.

I was hoping to get something like that going in REALbasic, and Brian Rathbone did all the hard work to make that possible. You will find the resulting source code (paster5.zip) at http://traver.org/traverrbw/.

Here's how to use "Paster." Put your "boilerplate" text in a plain text file, with one item per paragraph (but no blank lines between paragraphs). When you're using "Paster," load that file into Paster. (For some reason, I wasn't able to get LoadFile working in the MenuBar, which is where such is usually found, so I had to use a PushButton.) Then work with your other program. When you want to paste in some boilerplate text, double-click on the appropirate line in the Paster ListBox. That's all there is to it!

Due to the eccentricities of various programs, "Paster" works with some and not with others. The following list will give you an idea of some of the ones that work with "Paster" and some that don't, based on my experimentation thus far:

With Edit Pad Pro, I get an error message, "Cannot open clipboard."
With Firefox, it seems to work fine.
With Internet Explorer, it seems to work fine.
With Notepad, nothing seems to happen. Nothing is pasted in.
With NoteTab Pro, it's rather flaky (some clicks will work, but most will not).
With Thunderbird, it seems to work fine.
With Microsoft Word, it seems to work fine.
With WordPad, it seems to work fine.

Thus "Paster" works more often than not, but it's difficult to predict in advance whether it will work with the particular program with which you may want to use it.

One more comment about "Paster." You can move the window using "Drag" and "Drop," BUT you see no indication of its being moved until the "Drop." The fancy tricks that allow "Paster" to work somehow also produce this side effect, for which no alternative has yet been found. As long, however, as you know about the quirk, you should be able to live with it.

As usual, the source code is supplied with the understanding that if you improve the program you are to send me (if possible) a copy of your modified version. Thank you (and thanks again to Brian Rathbone for sharing his code).

Enjoy!

Barry Traver

0 Comments:

Post a Comment

<< Home