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

In reply to Re: OS-integrated Perl by BrowserUk
in thread OS-integrated Perl by Sprad

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.