Setting file open with property

Hi,

With the Finder (Get Info), you can change the application a file is opened with. Is it possible to script this so I can make a file always open with a specific app? There doesn’t seem to be any Finder property. I’m not sure if this info is stored as the creator code or in the resource fork?

Thanks.

I think this info should be stored in the LaunchServices.plist file.

Thanks jj.

I looked only briefly at LaunchServices. Maybe it keeps information about all files with a particular extension.

What I’m hoping to do is set one specific file (or group of files) to open with a particular app.

I’ll check into this more someday but for now the need isn’t too urgent. It would be nice though.

Thanks.

Gary

Yes, you’re rigth, sorry :smiley:

I’ve been testing and seems it creates a new resource-fork resource named “usro” (I guess it stands for “user options” or something similar). It creates also a “icns” for the related app’s icon, but it isn’t needed for the basic funcionality.

I did a test: copy-paste this resource in a different file. And it opened with the related app.

So, you may need, probably:
-Satimage.osax, to insert the relevant “usro” resource (and “icns”, if you wish), if your file contains itself some resource-fork info.
-A simple “do shell script” call to insert this resource-fork in your file, if it’s a plain datafork file. Eg:

do shell script "cp /filecontainingtherelevantresource_usro/rsrc /targetdataforkfile/rsrc"