• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Programmatically Change Icon
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically Change Icon


  • Subject: Re: Programmatically Change Icon
  • From: "I. Savant" <email@hidden>
  • Date: Sun, 22 Mar 2009 13:55:52 -0400

On Mar 22, 2009, at 12:27 PM, Pierce Freeman wrote:

I am wondering if there is some way to change another applications icon
programmatically. The problem that I see if that every application's icon
name is different and I haven't found a way to read that application's icon
location or will just return a NSImage that is the icon.

Problems:

1 - Not all users are administrators of their computer, and so a user- space application may not be able to modify the application bundles in question. You'll need to authenticate/authorize the user to perform this change if the application is in the /Applications folder, or the user has no write permissions for the app bundles otherwise.

2 - Some applications may be digitally signed, in which case modifying the application bundles in question may at least cause disconcerting warnings for the user launching the modified applications, and at worst break the application(s).

3 - This may be technically in violation of the EULA of the applications in question. IANAL, but I certainly would look into this before trying it, especially with the very loosely-defined DMCA laws.

4 - All the above aside, make sure you have your users' express permission to perform this action ... it is a pretty big deal and I would personally not use any application that does this, and you can count on others feeling the same way, so make sure you ask in very clear, plain language.

That said, to get the application's icon, you can do what the Finder does and use the app bundle's Info.plist and ask for the value for the CFBundleIconFile key. Then ask the application bundle for the resource with the returned name.

See the documentation for the permissions issue and for how to work with the icon file format.

--
I.S.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Programmatically Change Icon
      • From: Pierce Freeman <email@hidden>
References: 
 >Programmatically Change Icon (From: Pierce Freeman <email@hidden>)

  • Prev by Date: Re: NSAppleScript - what is going on here?
  • Next by Date: How to get events in PDE auxiliary window?
  • Previous by thread: Programmatically Change Icon
  • Next by thread: Re: Programmatically Change Icon
  • Index(es):
    • Date
    • Thread