Another way is to use Win32::Process. I knew from the Chatterbox that you were looking for a Windows solution. This worked for me, but it will probably need modification from you to work correctly. In particular, look at the second and third params to the Create function.

use strict; use Tk; use Win32::Process; my $process; my $mw = MainWindow->new; $mw->Button( -text => "Open Adobe", -command => \&openAdobe )->pack; MainLoop; sub openAdobe { Win32::Process::Create( $process, "C:\\Program Files\\Adobe\\Acrobat 6.0\\Reader\\AcroRd32.exe", "/n /s my.pdf", 0, DETACHED_PROCESS, "."); }

Do a search for Win32::Process on the the comp.lang.perl.tk newsgroup through Google groups or lots of other examples. Also check out the docs for Win32::Process.

Update: Corion's approach is better in many ways, though he is missing a closing brace ;-) The advantages should be clear, but I'll post them anyhow:

  1. It's simpler.
  2. No pesky Win32::Process library with the UGLY Create call
  3. No need to have knowledge of where Acrobat is installed on client machines.

Rob

In reply to Re: Perl Tk: opening a file in its original format by rcseege
in thread Perl Tk: opening a file in its original format by FM

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.