Hi,
In my application, it’s possible to change the icon from a menu in the Preferences pane.
For info:
property pref_AppIcon : missing value -- menu
property pathNewIcon : missing value
property pathOldIcon : missing value
on applicationWillFinishLaunching_(aNotification)
set pathOldIcon to (current application's NSBundle's mainBundle()'s pathForResource_ofType_("Icon", "icns") as string)
end applicationWillFinishLaunching_
on changeAppIcon_(sender)
if (pref_AppIcon's indexOfSelectedItem()) is 0 then
set pathNewIcon to (current application's NSBundle's mainBundle()'s pathForResource_ofType_("Icon00", "icns") as string)
else if (pref_AppIcon's indexOfSelectedItem()) is 1 then
set pathNewIcon to (current application's NSBundle's mainBundle()'s pathForResource_ofType_("Icon01", "icns") as string)
else if (pref_AppIcon's indexOfSelectedItem()) is 2 then
set pathNewIcon to (current application's NSBundle's mainBundle()'s pathForResource_ofType_("Icon02", "icns") as string)
else if (pref_AppIcon's indexOfSelectedItem()) is 3 then
set pathNewIcon to (current application's NSBundle's mainBundle()'s pathForResource_ofType_("Icon03", "icns") as string)
end if
do shell script "ditto -rsrc " & "/" & quoted form of pathNewIcon & space & "/" & quoted form of pathOldIcon
end changeAppIcon_
It works. The icon is changed into the application but after relaunching the Finder, the Dock, and the application, there is always the old icon in the Finder’s window and in the Dock.
I didn’t have this problem with Leopard, Snow Leopard, Lion, and Moutain Lion.
Now with Mavericks, I must be restarted…
If you have a solution without restart… Thanks a lot!