Re: Opening file with application

2002-09-10 Thread Joel Rees

 Methinks we shouldn't be going down this path, really.  Apple has a defined
 way to get to this stuff:
 
 http://developer.apple.com/technotes/tn/tn2017.html
 
 ...which is probably exactly what the 'open' command uses to figure out
 which application to launch.

Oh, darn. No excuse to write arcane code today. :)

Methinks youthinks right. Thanks for the link.

-- 
Joel Rees [EMAIL PROTECTED]




Re: Opening file with application

2002-09-09 Thread John Labovitz

On 9/8/02 9:51 PM, Joel Rees [EMAIL PROTECTED] wrote:

 John Labovitz [EMAIL PROTECTED] responded:
 
 On 9/8/02 8:01 PM, Joel Rees [EMAIL PROTECTED] wrote:
 
 Obvious thought, but have you tried plist?
 
 It doesn't seem to be that -- I tried both pl and plutil, and neither
 wanted to read it.  But I have no experience with plists, so maybe I'm not
 running these correctly...
 
 
 Hmm --
 
   http://www.macaddict.com/osx/hacks/pledit.html
 
 talks about PropertyListEditor or something like that. (picked up by
 searching with google for plist.)
 
 They don't let me use my iBook at work, so I can't check what it was I
 used last, but I keep trying to convince myself that some editor allowed
 me to load and save compressed plist files. I'm probably confused,
 though, seems like I spend most of my time confused.

Ah, yes -- PropertyListEditor does exist (in the Developer Tools), but
crashes when trying to load that cache file. :(

Methinks we shouldn't be going down this path, really.  Apple has a defined
way to get to this stuff:

http://developer.apple.com/technotes/tn/tn2017.html

which is probably exactly what the 'open' command uses to figure out
which application to launch.

-- 
John Labovitz
[EMAIL PROTECTED]
www.johnlabovitz.com




Re: Opening file with application

2002-09-08 Thread Ward W. Vuillemot

Not that I have an answer...but I have a similar problem.  I can launch 
MS Excel and have it open a OTF generated file from Win32.  But Mac OS X 
does not do itmaybe I should read the docs, but...if I backtick an 
`open /dir/to/msexcel` Excel opens, but the redirect, or `open 
/dir/to/msexcel  $file`` does not work.  That is to say, MS Excel 
(Classic) still opens from within Perl on Mac OS X, but I cannot get it 
to open the file itself...which is a pain in the butt. I figured if I 
got Mac OS X version MS Office things might get rectified, but I have 
yet to get an upgrade.

I put my vote in for any ideas on a non-OS specific solution to opening 
an application and having said application open a file to boot.  ;)

Cheers,
Ward

On 2002.09.08, at 11:06, John Delacour wrote:

 At 8:48 am -0700 8/9/02, Enrique Terrazas wrote:

 How about using SetFile (installed by the developer tools) to set the
 creator and file type to excel, and then using the open command?

 Well a) I don't want to change the file creator and b) only a small 
 minority of users will have Setfile installed.

 JD





Re: Opening file with application

2002-09-08 Thread John Labovitz

On 9/8/02 2:20 PM, Ward W. Vuillemot [EMAIL PROTECTED] wrote:

 maybe I should read the docs, but...if I backtick an
 `open /dir/to/msexcel` Excel opens, but the redirect, or `open
 /dir/to/msexcel  $file`` does not work.

Do you really need to use redirection?  If you're trying to just launch
Excel with a certain file, use the -a flag:

open -a /dir/to/msexcel $file

I just did some testing, and it looks like you don't even have to supply the
path to Excel.  Here's exactly what I typed:

open -a Microsoft Excel /tmp/t.txt

If you really want to use redirection, I think you're out of luck.  Either
Excel would have to know the concept of standard input (not likely,
especially given that it's a Classic app), or the open command will need
to save the input away in a temporary file, then pass that temporary
filename to Excel (then delete the file -- unless the app wants to save
it!).

-- 
John Labovitz
[EMAIL PROTECTED]
www.johnlabovitz.com




Re: Opening file with application

2002-09-08 Thread Charles Albrecht

The docs - for open(1) in particular - might suggest something along the
lines of:

`open -a Microsoft Excel $foo`

(or whatever the Excel executable happens to be called on the target system)

But some versions of Excel (mine is ancient - YMMV with something newer
than v.4) might refuse to open files with an unfamiliar type.

-Charles
 [EMAIL PROTECTED]


At 2:20 PM -0700 9/8/2002, Ward W. Vuillemot wrote:
Not that I have an answer...but I have a similar problem.  I can launch MS Excel and 
have it open a OTF generated file from Win32.  But Mac OS X does not do itmaybe I 
should read the docs, but...if I backtick an `open /dir/to/msexcel` Excel opens, but 
the redirect, or `open /dir/to/msexcel  $file`` does not work.  That is to say, MS 
Excel (Classic) still opens from within Perl on Mac OS X, but I cannot get it to open 
the file itself...which is a pain in the butt. I figured if I got Mac OS X version MS 
Office things might get rectified, but I have yet to get an upgrade.




Re: Opening file with application

2002-09-08 Thread Puneet Kishor


On Sunday, September 8, 2002, at 05:58  PM, John Delacour wrote:

 At 4:33 pm -0600 8/9/02, Charles Albrecht wrote:


 `open -a Microsoft Excel $foo`

 (or whatever the Excel executable happens to be called on the target 
 system)

 But some versions of Excel (mine is ancient - YMMV with something newer
 than v.4) might refuse to open files with an unfamiliar type.

 Aha! That's the sort of thing I needed, and it does work with my Excel 
 1998 running in Classic.

 Even this works:   !

 open -a SimpleText junk.txt

 So at last Application names are cached somewhere with their paths. And 
 about time too.  Where?


from man open...

The open command opens a file (or a directory), just as if you had dou-
  ble-clicked the file's icon. If no application name is specified, 
the
  default application as determined via Finder is used to open the 
speci-
  fied files.

my emphasis... as determined via Finder So, in fact, you don't even 
have to do...

`open -a Microsoft Excel $foo`

because...

`open foo.xls`

would work just as well, because the Finder knows that .xls has to be 
opened with Excel.

--
Puneet Kishor
[EMAIL PROTECTED]




Re: Opening file with application

2002-09-08 Thread Joel Rees

John Labovitz [EMAIL PROTECTED] contributed

 On 9/8/02 3:58 PM, John Delacour [EMAIL PROTECTED] wrote:
 
  So at last Application names are cached somewhere with their paths.
  And about time too.  Where?
 
 Maybe here:
 
 /Library/Caches/com.apple.LaunchServices.LocalCache.csstore
 
 but it's binary, and I don't know how it's formatted.
 
 -- 
 John Labovitz
 [EMAIL PROTECTED]
 www.johnlabovitz.com

Obvious thought, but have you tried plist?

-- 
Joel Rees [EMAIL PROTECTED]




Re: Opening file with application

2002-09-08 Thread Joel Rees

John Labovitz [EMAIL PROTECTED] responded:

 On 9/8/02 8:01 PM, Joel Rees [EMAIL PROTECTED] wrote:
 
  Obvious thought, but have you tried plist?
 
 It doesn't seem to be that -- I tried both pl and plutil, and neither
 wanted to read it.  But I have no experience with plists, so maybe I'm not
 running these correctly...
 

Hmm --

http://www.macaddict.com/osx/hacks/pledit.html

talks about PropertyListEditor or something like that. (picked up by
searching with google for plist.)

They don't let me use my iBook at work, so I can't check what it was I
used last, but I keep trying to convince myself that some editor allowed
me to load and save compressed plist files. I'm probably confused,
though, seems like I spend most of my time confused.

Anyway, the file info app (cmd-i) allows you to set the default
application for a single file or a file's type, as I recall, which is
probably more to the point of the original question, now that I think
about it.

Plugging that path you mentioned:

/Library/Caches/com.apple.LaunchServices.LocalCache.csstore

into google produced three moderately interesting results, too.

(Hope you don't mind if I bounce this back to the list.

-- 
Joel Rees [EMAIL PROTECTED]