Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

For extra added fun, and laziness, add the Win32::Guitest Module into the mixture. That way you can use SendKeys() to send a copy and or paste, and only have to push your double bucky.

For this to work properly, you need to either add an extension for windowless perl scripts (i.e. using wperl) or change the batch file to call on wperl.

I have noticed a few things in Win32::Clipboard and Win32::GUITest that can bite you if you're not careful, first, it doesn't get the magic line-break translation that files and other IO operations do, so your linebreaks (mine were at least) will likely be \r\n instead of just \n. It may or may not matter according to where you are putting the output (my Email client doesn't much like just one or the other). Also apparenly, chomp only cut's off the \n, so you've gotta watch for that. And in ::GUITest, with the Sendkeys() you have to use lowercase for ctrl+c and ctrl+v, else you may end up not getting the effect you expected.

And now, a sample piece of code for making ordered lists, nice and easy, it's even set up so you can run it over pieces of text that have already been tagged, so you can make nested lists.

#!perl use Win32::GuiTest qw(SendKeys); use win32::Clipboard; my $CLIP = Win32::Clipboard(); SendKeys("^c"); my $alter = $CLIP->Get(); my @alter = split /\r\n/, $alter; foreach (@alter) { if (/\W/) { $_ = "<li> $_ </li>" if !/<li>/; $_ .= "\r\n"; } else { $_="\r\n"; } } $alter = join("",@alter); $alter = "<ol>\r\n".$alter."</ol>"; $CLIP->Set($alter); SendKeys("^v");

In reply to Advanced Clipboard transform keys by Koosemose
in thread Clipboard transform keys by PhilHibbs

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (9)
    As of 2014-12-18 04:25 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (41 votes), past polls