Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: OS-integrated Perl

by BrowserUk (Patriarch)
on Mar 01, 2004 at 23:23 UTC ( [id://333098]=note: print w/replies, xml ) Need Help??


in reply to OS-integrated Perl

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://333098]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2025-06-14 14:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.