From: rpnoble <rp...@ib...> - 2008-04-09 06:23:36
|
Gabriel R. Toro wrote: > > Hi, > > This question may be too simple for this group; if so, I apologize. I > only use perl once in a while and this is my first experience with > Win32::GUI. > > I wrote a simple perl script that calls GetSaveFileName to get the > name of an output file and then calls the shell to execute some > separate programs (I get the same problems using backtics or system). > After the call to GetSaveFileName, the shell commands do not seem to > find the necessary files (even though the files exist in the current > directory), unless I specify the full path for those files. If I > remove the call to GetSaveFileName and hard-wire a name, everything works. > > It is not a problem with the subroutine that calls GetSaveFileName; > the subroutine returns the right name (including full path). It seems > like Win32::GUI is having some undesirable side effect: > -does Win32::GUI change the current path? (my tests suggests it does not) > -does Win32::GUI change the shell that executes the backtick or > system commands or the settings of that shell? > -anything else? > > I would appreciate any suggestions. > > Thanks, > > Gabriel > > > PS: Here is my GetSaveFileName (which, as I indicated, is working OK > except for the "side effects"). > sub GetSaveFileName > # > # returns selected pdf file > # #no arguments (may want to add them later) > { > use strict; > use warnings; > > use Win32::GUI qw(); > > my $window_main = Win32::GUI::Window->new( > -name => 'window_main', > -size => [320, 240], > -title => 'CmnDlg - Save > As', > ); > > $window_main->Show(); > > my $file = ''; > my $directory = 'C:/'; > > # Save as file dialog box, show files with *.txt extension, in messages > folder > > $file = Win32::GUI::GetSaveFileName( > -owner => $window_main, > -title => 'Select > Output pdf file', > -directory => $directory, > -filter => ['Pdf > files', '*.pdf', 'All files', '*.*'], > -file => $file, > ); > return $file; > } > 1 # needed if we are using require > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Register now and save $200. Hurry, offer ends at 11:59 p.m., > Monday, April 7! Use priority code J8TLD2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ > > Have you tried quoting the command line string? Under Windows XP you have to quote the command line paths if spaces are in the path. -- View this message in context: http://www.nabble.com/Problem-executing-shell-commands-from-within-perl-after-call-to-GetSaveFileName-tp16558563p16580369.html Sent from the perl-win32-gui-users mailing list archive at Nabble.com. |