Category: | Win32 Stuff |
Author/Contact Info | Rudif@lecroy.com |
Description: | I wanted to convert a large number (several hundred) of strings from mixed case to upper case.
Strings were accessible one at a time, through a dialog belonging to a particular application. So, I sat down to do the work: Ugh. Retyping was the longest and most error-prone part of the operation. And easiest to mechanize, if I could hook Perl into my loop. I remembered Win32::Clipboard and quickly whipped up this script, ucclip.pl. Now the slog became bearable (almost pleasant, in a cyborg sort of way):
|
#!perl -w use strict; use Win32::Clipboard; my $clip = Win32::Clipboard("uppercases the clipboard content"); for (;;) { $clip->WaitForChange(); my $text = uc $clip->GetText(); last if $text =~ /^\s*$/; print "$text\n"; $clip->Set($text); } __END__ =head1 NAME ucclip.pl =head1 SYNOPSIS ucclip =head1 DESCRIPTION Loops waiting for change in contents of your Windows Clipboard. Converts any string that you copy into the Clipboard to uppercase, ready for pasting. Also prints the converted string to the console window. Exits when you copy a blank string into the Clipboard. =head1 SEE ALSO perl(1), Win32::Clipboard =head1 AUTHOR Rudi Farkas rudif@lecroy.com 7 Apr 2002 =cut |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Me in a loop with Win32::Clipboard
by clemburg (Curate) on Apr 08, 2002 at 13:00 UTC |
Back to
Code Catacombs