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:
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |