On Mar 23, 2004, at 19:57, Jim Correia wrote:
On Mar 23, 2004, at 6:35 PM, Chris Devers wrote:
Yeah, this bugs me too.
I *think* this is really a shell vs. Finder issue, and I don't know what
the fix is, but generally it seems like if you want to work on a
collection of files, the Finder can operate on that collection as a set --
hence opening PDFs together in Preview, or a directory or a directory tree
full of MP3s in iTunes, etc -- but if you do the same sort of thing from
the command line, it's as if you sent out a series of commands such as
"open -a foo bar1; open -a foo bar2; open -a foo bar3;" etc.
Annoying.
To date, I haven't found a way around this. The issue is broader than just
Preview & PDFs though -- something the Finder is doing allows collections
of files to be handled as a single set, and nothing I've tried from the
command line has been able to reproduce that functionality.
It isn't a command line vs. Finder issue. It has to do with how the information is passed to the app - in one lump, or one at file at a time.
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!) ;-)
BPR
Not having the source code for open, I don't know how it is implemented.
One could have implemented it to send a single 'odoc' apple event with a list of files, or by using one of the LaunchServices APIs that takes a list of files or urls, and it would have done what you wanted.
Jim
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please take the time to preview my forthcoming book of essays!
http://www.ZeusonaCork.com
Join the blog too! Thank you!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -