Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: Win32::OLE and Adobe Acrobat

by blm (Hermit)
on Jan 11, 2006 at 11:52 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2023-03-24 16:05 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (61 votes). Check out past polls.