On Mon, 29 Mar 2004, Joseph Alotta wrote:

> On Mon, 29 Mar 2004, <???> wrote:
> 
> > Yes - I think you're kind of right, so, if you have the command line 
> > as such: system "open *.pdf";
> >
> > This would expand to match everything such as:  system "open a.pdf 
> > b.pdf c.pdf d.pdf";
> > Each of the items are treated in an Unix shell as separate arguments.
> >
> > Now, for (heh heh) arguments sake, if we executed the same command as 
> > such:
> >
> > system 'open a.pdf b.df c.df d.pdf';
> >
> > This would treat the list passed as ONE argument.
> >
> > This statement would fail:  system 'open *.pdf'; since expansion of 
> > the wildcard character would not take effect (due to the syntax).
> >
> > The key is to write a little shell program which would collect all 
> > *.pdf into a list of one argument passed to the "system open" command.
> >
> > Now go fish!   (parable, sorry!)   ;-)
> 
> I tried your advice and it still doesn't work.  It still opens each
> file in a separate window.
> 
> 
> 
>   [Abba:~/oldperlcode] josephal% ./test
>   [Abba:~/oldperlcode] josephal% cat ./test
>   #!/usr/bin/perl
> 
>   system "open /Users/josephalotta/Desktop/Picture1.pdf 
>   /Users/josephalotta/Desktop/Picture2.pdf";
> 
>   [Abba:~/oldperlcode] josephal%


That isn't quite what was being suggested though -- you double-quoted it.
I'm not sure if that matters, but it isn't what was suggested.

In any case, the example being given here would work just fine when pulled
out of the shell script & run from the command line. Consider:

    $ ls h*pdf
    hosts_alia.pdf  hosts_canon.pdf
    $ open hosts_alia.pdf hosts_canon.pdf  # documents open separately
    $ open "hosts_alia.pdf hosts_canon.pdf"
    2004-03-29 16:10:28.558 open[8355] No such file:
    /homes/file4/cdevers/docs/hosts_alia.pdf hosts_canon.pdf
    $ open 'hosts_alia.pdf hosts_canon.pdf'
    2004-03-29 16:10:34.446 open[8356] No such file:
    /homes/file4/cdevers/docs/hosts_alia.pdf hosts_canon.pdf

The example here depends on the behavior of /usr/bin/open, and any
problems in that program will be manifest whether you're invoking it
directly from the command line or indirectly through a Perl script.
Therefore, the Perl version is just adding complexity here and is giving
you another thing to debug -- it would be better to test this another way.

Because /usr/bin/open appears to be broken, and because it has behaved
this way for a while now, AppleScript seems more promising as a way to
open multiple documents as a set... 


-- 
Chris Devers

Reply via email to