Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Copy & copy... Win32 clipboard utilityby boo_radley (Parson) |
on Feb 06, 2002 at 15:24 UTC ( [id://143637]=CUFP: print w/replies, xml ) | Need Help?? |
The Data70 pages of text and images, formatted in an old print publication layout program.The TaskTurn it all into HTML.The Feeble AttemptsProgram does not export to HTMLProgram claims to output to both postscript and PDF. Lies. Exporting to these formats and then attempting to use a *2HTML converter proves worthless. No documentation is available for the program to see if it's automatable through Win32::OLE. The Horrible ConclusionA whole lot of cutting & pasting.The MantraPerl makes easy things easy and hard things possible.The Codeexplained : Set up a new Win32::Clipboard object & clear the contents. Then set up a new $SIG{INT} handler to capture ctrl+c, which will be the 'exit' command. loop while there's no text in the clipboard & the user hasn't pressed ctrl+c yet. inside the loop, print the clipboard contents to STDOUT & STDERR, then clear them again. usage : perl clipboard.pl >1.txt arranged windows so that the layout program & a dos window were side-by-side. Starting with the first text element at the top of page one, select all of the element's text & copy. Move to next element, copy. Repeat for each text element. Hit ctrl-c. move to next page in layout software & start perl clipboard.pl >2.txt... The entire process took a bit over 15 minutes once I got a rhythm down. Used the resulting files to craft simple XML documents, then applied a stylesheet to flesh out the HTML. Total Elapsed Time : 2 hours Thanks, perl!
Back to
Cool Uses for Perl
|
|