Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Auto text format cleanup via Win32::Clipboard

by OeufMayo (Curate)
on Aug 20, 2001 at 03:44 UTC ( #106099=note: print w/ replies, xml ) Need Help??


in reply to Auto text format cleanup via Win32::Clipboard

Here's a Win::32 Clipboard Auto Formater boosted with Good Dr Conway's Steroids!

Text::Autoformat does a really good job at finding patterns in a non structured text, and format it properly. I use it on a daily basis (mail, documentation), along with perltidy. These two tools save me hours of painful reformatting.

#!/usr/bin/perl -w use strict; use Win32::Clipboard; use Text::Autoformat; my $clipboard = Win32::Clipboard(); $clipboard->Empty(); print "Text auto-format-clean when copied to the clipboard is active +.\n"; print "To exit, CNTL-C out of this window.\n"; while (1) { $clipboard->WaitForChange(); my $text = $clipboard->GetText(); next if ($text eq ''); $text = autoformat($text, {all=>1}); # The magic kicks in. $clipboard->Set($text); } exit;

Untested, but it should work (having said that, I won't be surprised that it dies horribly)

<kbd>--
my $OeufMayo = new PerlMonger::Paris({http => 'paris.mongueurs.net'});</kbd>


Comment on Re: Auto text format cleanup via Win32::Clipboard
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (14)
As of 2015-07-31 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (282 votes), past polls