This works for me:

use Win32::FileOp qw(:BASIC ShellExecute);
ShellExecute 'open' => $List[$Reply][2], -1, -1 or die('Could not execute');

I used it for opening all kinds of files including html and url's to launch the
default browser. I believe it can be found in Jenda's repository
http://jenda.krynicky.cz/

Regards,
Huub Peters

----- Original Message ----- From: "Dirk Bremer" <[EMAIL PROTECTED]>
To: "Active State Perl" <Perl-Win32-Users@listserv.ActiveState.com>
Sent: Tuesday, May 09, 2006 9:49 PM
Subject: Calling Acrobat Reader


I'm developing a nice little program that will search a directory on
another server and return the results based upon several search
criteria. The files being listed as the result of the search are PDF
files. I would like to offer an option in this program to allow the user
to select a file and then have the program start Acrobat Reader opening
the selected file.

I have all but this last bit down and I'll explain further. I have
gotten to the part where the user selects the file and I am trying to
open it with:

   system('AcroRd32.exe',$List[$Reply][2]);

I have verified that $List[$Reply][2] contains a fully qualified
UNC-path and filename. The results are:

'AcroRd32.exe' is not recognized as an internal or external command,
operable program or batch file.

So, we now know that the Acrobat Reader in not in the system path. In
fact, its exact location can very from machine to machine. On my
machine, it is:

   C:\Program Files\Adobe\Acrobat 7.0\Reader

Note that based upon the version (dating back to 4.x), the path can
change. This would make it difficult using a brute-force approach to
locating the executable.

But Windows knows where AcroRd32.exe lives and knows that when you
double-click on a PDF-file to execute it.

How can I emulate this behavior so that the Perl program can determine
no matter where the executable lives on a given user's PC, and for that
matter, whatever the executable name is that is associated with opening
PDF-files is, the executable name and its path. I would imagine that
this will require some search of the registry which I have no experience
with from within Perl. I would like any methodology to be used to be
relatively fast in locating the executable.

Dirk Bremer - Senior Systems Engineer - ESS/AMS - NISC Lake St. Louis MO
- USA Central Time Zone
636-755-2652 fax 636-755-2503

[EMAIL PROTECTED]
www.nisc.coop

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs




_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to