Set this going in the background somewhere ( eg. start /b clippy.pl ) or you could daemonise it with Win32::Daemon and then whenever you cut or copy some text into the clipboard, when you paste it, it will have been ucfirst'd.
Of course, as is that is just annoying when you don't want it done (which is exactly what happened to me when I just c&p'd the program code below:), but it illustrates the idea.
There are various ways you could control the behaviour. Pop up a dialog with a set of buttons control what modification is made. Or prefix the text with an instruction telling it what to do, and do nothing if a known prefix is not found. That's left as an exercise for the reader.
#! perl -slw
use strict;
use Win32::Clipboard;
my $clip = Win32::Clipboard->new;
while( $clip->WaitForChange ) {
next unless $clip->IsText;
my $text = $clip->GetText(); ## Grab it
$text =~ s[\b(\S+)\b][ ucfirst $1 ]eg; ## Modify it
$clip->Set( $text ); ## Put it back so the user can paste it.
}
__END__
the quick brown fox
The Quick Brown Fox
I frequently c&p text into a free, web-based language translation service. With the addition of some LWP or WWW::Mechanise, this could be really useful.
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
|