After further research I found this problem is affecting more users than I realized. Most of them have file associations set that run UltraEdit for the files we're commonly downloading. So this obscured the problem, since when it occurs it results in Windows falling back to the default application for that file. However, some files we download have no extension or one associated with another application and when I had people test that scenario the problem surfaced for everyone but one other user and myself. It seems to be related to the quotes around the path - which are necessary since "program files" has a space in the middle. BTW, we're all running either Win2K or XP.

As a work around, the following code works on my machine:

      my $ProcessObj;
      my @temp = split( /\\/, $EDITOR );
      my $exe = pop( @temp );
      Win32::Process::Create($ProcessObj,
                             $EDITOR,
                             "$exe $file",
                             0,
                             NORMAL_PRIORITY_CLASS,
                             "."
                            ) || WinError();

Next week I'll give this to the other people in my group to see if it solves the problem.

Thanks for everyone's help.

Roy Olsen


What about using Win32::Process::Create?

----- Original Message -----
From: "Roy Olsen" <[EMAIL PROTECTED]>
To: <perl-win32-users@listserv.ActiveState.com>
Sent: Friday, July 01, 2005 11:56 AM
Subject: system() Conundrum


>
> I have a Perl script that receives programs and other files from a host
> system for editing.   Once the file is transferred the script launches my
> text editor and passes it the name of the file.  It works fine for me and
> several colleagues.  However, on one user's brand new system (with XP Pro
> and Perl v5.8.6) it won't launch the editor, instead it brings up the
> windows dialog for selecting which program to use.
>
> To make it flexible, I read an environment variable that contains the path
> to the editor.  Here's the relevant bits of code:
>
> $EDITOR = $ENV{BASIC_EDITOR};
> ...
>     if ($EDITOR) {
>        system( "start $EDITOR $file" );
>     }
>
> It seems that windows is seeing something like:
>
>          start  SomeFile
>
> with the editor path being omitted.  To track down the cause of this I
> setup some one line test scripts we could run on this user's system.  This
> example launches Win.ini in notepad:
>
>          system( "start \"c:/program files/ultraedit/uedit32.exe\"
> c:/windows/WIN.ini" );
>
> Again, somehow the program name is disappearing or being ignored.
However,
> running this next script in "c:\program files\UltraEdit" opens Win.ini in
> UltraEdit like I'ld expect:
>
>          system( "start uedit32.exe c:/windows/WIN.ini" );
>
> Why would it work this way and only on one user's system??
>
> Roy Olsen
>
>


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

Reply via email to