Re: How to set the name of open-with application for a specific file?

2009-08-02 Thread MATSUMOTO Satoshi

I have found an undocumented api to do this.
I think this api is not opened to the public because of the security  
reason.


Satoshi

On 2009/07/31, at 22:00, MATSUMOTO Satoshi wrote:


Dear Jerry Krinock,

On 2009/07/31, at 21:43, Jerry Krinock wrote:
Activate Finder.  Select a subject document file.  In main menu  
click File  Get Info.  In the Info Window which appears, click  
Open with... and if desired click the Change All button.


Thank you for your kind advice. :-)
I want to do this programmatically.

Satoshi
-
Satoshi Matsumoto sato...@mac.com
816-5 Odake, Odawara, Kanagawa, Japan 256-0802



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/satoshi%40mac.com

This email sent to sato...@mac.com


-
Satoshi Matsumoto sato...@mac.com
816-5 Odake, Odawara, Kanagawa, Japan 256-0802



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the name of open-with application for a specific file?

2009-08-02 Thread Kyle Sluder

On Aug 2, 2009, at 6:00 PM, MATSUMOTO Satoshi sato...@mac.com wrote:


I have found an undocumented api to do this.


Then please don't use it. :) There is no guarantee that undocumented  
API will continue to function on any previous, future, or even current  
version of the OS.


I think this api is not opened to the public because of the security  
reason.


Sounds like a good enough reason to me. I wouldn't want some rogue app  
associating itself with whatever files it pleased. Remember the fiasco  
when QuickTime, Real Player, and WMP all tried this on Windows?


--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the name of open-with application for a specific file?

2009-08-02 Thread Harry Jordan
(Not sure why this didn't get sent to the list the first time round, but
here it is for the Google bots to pick up)

The place to look is the Launch Services Reference, in particular the
LSSetDefaultRoleHandlerForContentType() function.
I haven't used the setter functions myself, but it looks reasonable.
Hope that helps.

Harry
http://inquisitivesoftware.com/

On 31 Gorff 2009, at 14:00, MATSUMOTO Satoshi wrote:

Dear Jerry Krinock,


On 2009/07/31, at 21:43, Jerry Krinock wrote:

Activate Finder.  Select a subject document file.  In main menu click File 
Get Info.  In the Info Window which appears, click Open with... and if
desired click the Change All button.


Thank you for your kind advice. :-)

I want to do this programmatically.


Satoshi

-

Satoshi Matsumoto sato...@mac.com

816-5 Odake, Odawara, Kanagawa, Japan 256-0802
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the name of open-with application for a specific file?

2009-08-02 Thread Quincey Morris

On Aug 2, 2009, at 20:09, Harry Jordan wrote:


The place to look is the Launch Services Reference, in particular the
LSSetDefaultRoleHandlerForContentType() function.
I haven't used the setter functions myself, but it looks reasonable.
Hope that helps.


My interpretation was the the OP wants to set it for a single  
(document) file, not change the application for all files of the type,  
and I don't see a Launch Services function for *that*.


Presumably the Finder does this by storing something in the file's  
metadata, that doesn't involve Launch Services at all (or perhaps only  
via private API). If that's so, there might be a way to do it via  
AppleScript, but I'll leave it to those who know something about that  
to comment.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the name of open-with application for a specific file?

2009-08-01 Thread Alexander Bokovikov


On 31.07.2009, at 21:41, MATSUMOTO Satoshi sato...@mac.com wrote:


I want to do this programmatically.


The direct answer to this question is very easy - it's impossible.  
Why? Take a look here:


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

Nevertheless, if I understand it correctly, you need to create a  
situation, when your app will be shown within the Open With menu for  
appropriate file type, after user has installed your app on his/her  
computer. If this is the case, then all what you need to do is the next:


- provide appropriate info.plist with your app bundle;
- place your app into Applications folder (with app installer's help).

I did it manually (the second part) and it works without any problems.

Going ahead, a question raises, how to make our great app to be the  
default application for this file type? First of all read the topic,  
next to the above mentioned. Then... really I never did it yet. As I  
believe, a specific API function is required here. I never tried it  
yet, though I will need to resolve the same problem soon. Therefore  
I'd like to ask you to let me know, if you'll have any success here.


Thanks.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the name of open-with application for a specific file?

2009-07-31 Thread Kyle Sluder

On Jul 31, 2009, at 12:40 AM, 慧 松本 sato...@mac.com wrote:



I want to change the name of the app used to open the file.


You want to actually change the name of the application itself? Sorry,  
that's not yours to touch. The user might not even have the rights to  
make this modification (non-admin user, for example).


Or do you want to choose a different application to associate with the  
file?


--Kyle Sluder___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the name of open-with application for a specific file?

2009-07-31 Thread MATSUMOTO Satoshi

Kyle Sluder, thank you for your response.

I want to choose a different application to associate with the file.

Satoshi

On 2009/07/31, at 16:53, Kyle Sluder wrote:

On Jul 31, 2009, at 12:40 AM, 慧 松本 sato...@mac.com  
wrote:




I want to change the name of the app used to open the file.


You want to actually change the name of the application itself?  
Sorry, that's not yours to touch. The user might not even have the  
rights to make this modification (non-admin user, for example).


Or do you want to choose a different application to associate with  
the file?


--Kyle Sluder


-
Satoshi Matsumoto sato...@mac.com
816-5 Odake, Odawara, Kanagawa, Japan 256-0802



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the name of open-with application for a specific file?

2009-07-31 Thread Jerry Krinock


On 2009 Jul 31, at 01:02, MATSUMOTO Satoshi wrote:


I want to choose a different application to associate with the file.


Off-topic but, oh well, you wouldn't have known

Activate Finder.  Select a subject document file.  In main menu click  
File  Get Info.  In the Info Window which appears, click Open  
with... and if desired click the Change All button.


The system's Launch Services database is sometimes kind of stubborn,  
though.  If you've changed any of the UTI information in the app's  
Info.plist, you may have to rebuild and relaunch the subject  
application a couple times before the new setting starts working.  If  
all else fails, delete the old application and restart.  As a last  
resort, rebuild the Launch Services database, but you're going to lose  
all your personal settings for other apps.  In Leopard, use this  
Terminal command:


System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/ 
LaunchServices.framework/Versions/A/Support/lsregister -kill -r - 
domain local -domain system -domain user

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the name of open-with application for a specific file?

2009-07-31 Thread MATSUMOTO Satoshi

Dear Jerry Krinock,

On 2009/07/31, at 21:43, Jerry Krinock wrote:
Activate Finder.  Select a subject document file.  In main menu  
click File  Get Info.  In the Info Window which appears, click  
Open with... and if desired click the Change All button.


Thank you for your kind advice. :-)
I want to do this programmatically.

Satoshi
-
Satoshi Matsumoto sato...@mac.com
816-5 Odake, Odawara, Kanagawa, Japan 256-0802



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How to set the name of open-with application for a specific file?

2009-07-31 Thread Jerry Krinock


On 2009 Jul 31, at 06:00, MATSUMOTO Satoshi wrote:


I want to do this programmatically.


I don't know if there are API to do this programatically or not.   
Search Xcode documentation for functions that Start With  LS.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com