On creating an exe, check out
Perl executables? or
perl to exe - they go through a couple of methods you can use.
For the printing, I would check out
Win32::CtrlGUI, for instance:
use Win32::CtrlGUI;
# Open file - do other stuff
my $window = Win32::CtrlGUI::wait_for_window(qr/$filename/);
$window->send_keys("^p{2}{ENTER}!fx");
You'll have to play around with it - I have no idea if this is right or if it works... but I hope it sets you on the right track.
Best,
-Adam
Update: I played around with this a little - and actually think this is quite a cool set of utilities... Now this isn't perfect, but I have some working code for you - it opens a file, sends command-p to print, hits enter in the new window - then exits the app, by hitting alt-f, then 'x' - again, not perfect, but quite enjoyed playing around with this mod...
use Win32::CtrlGUI;
$file = 'Untitled-1.pdf';
system("start $file");
my $window = Win32::CtrlGUI::wait_for_window(qr/$file/);
$window->send_keys("^p");
my $window2 = Win32::CtrlGUI::wait_for_window(qr/Print/);
$window2->send_keys("{ENTER}");
$window->send_keys("!f{1}x");
Update 2: Also, if you have any trouble finding Win32::Setupsup, as I did, just (ActiveState):
ppm install http://theoryx5.uwinnipeg.ca/ppms/Win32-Setupsup.ppd
--
By a scallop's forelocks!
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.