[Pythonmac-SIG] Help: how to programmatically set "open with" app in OSX

Jack Jansen Jack.Jansen@oratrix.com
Mon, 30 Dec 2002 21:04:27 +0100


On maandag, dec 30, 2002, at 20:35 Europe/Amsterdam, Nicholas Riley 
wrote:
>>> how can I programmatically set the "Open with:" default for .py files
>>> in MacOSX? I had expected this to work with the Internet Config API,
>>> but that doesn't seem to work. Can anyone point me in the right
>>> direction?
>>
>> Did anyone ever answer this? I could tell you how to give it a 
>> creator code
>> with AppleScript, which would accomplish exactly the same thing, but 
>> there
>> must be a "proper" OS X Unixy-method, I'm sure. I'd be interested to 
>> know
>> that method too.

Setting the creator would solve it for a single file, but I want to 
solve it system-wide (so all .py files that don't have an explicit 
creator are launched with (at the users' option) PythonLauncher or 
PythonIDE.

> It's private LaunchServices API, unfortunately.  From doing 'nm
> LaunchServices' it appears what you want is probably
> _LSSetWeakBindingForType.

Bah. And is there a way to send an AppleScript command to the finder 
(or maybe something else? A preference panel? A shell interface?) to 
accomplish this?

Adobe Acrobat Reader does seem to have a way to do this. At least: when 
you fire up a new Acrobat Reader for the first time it tells you it 
isn't the default app for pdf files, and whether you want to change 
that. Would they be using the private LS API, or would they have found 
some other way of doing this?
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -