Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Win32::OLE and Adobe Acrobat

by blm (Hermit)
on Jan 11, 2006 at 11:52 UTC ( [id://522410]=note: print w/replies, xml ) Need Help??


in reply to Win32::OLE and Adobe Acrobat

Actually you dont even need OLE to do this. There is a Win32 API call "ShellExecute" exported by shell32.dll. Basically you pick a file and what you want to do with it (open print etc) and it goes and looks up how to do it from the registry, starts the appropriate application and tells the application to perform the action. These actions are what you see as the first options in the right click context menu for the file that you want to perform the action on.

Knowing this I did a search for on Google and found this script by Brad Fitzpatrick (the livejournal guy). I then modified it and tested it on my computer and it works.

#!c:/perl/bin/perl -w use strict; use Win32::API; my $filename = "foobar.pdf"; my $shellopen = new Win32::API("shell32", "ShellExecute", ['N', 'P', 'P', 'P', 'P', 'I'], 'N'); $shellopen->Call(0, "print", $filename, 0, 0, 0);

You might have to install Win32::API but I had no trouble doing this with the ppm in the latest 5.8 perl from Activestate. Let me know if you have problems.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-20 02:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found