Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Printing various files from Perl and few other things.

by Adrade (Pilgrim)
on Jul 09, 2005 at 23:12 UTC ( [id://473716]=note: print w/replies, xml ) Need Help??


in reply to Printing various files from Perl and few other things.

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!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-25 05:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found