Adding custom icon to AS Studio Project

Hi,
I am trying to add a custom icon to my AppleScript Studio project. I have made my icons in Photoshop, imported them into Icon Composer and saved them as a .icns file. I have added them to my project. I have tried to find the dialog box outlined in http://developer.apple.com/documentation/AppleScript/Conceptual/StudioBuildingApps/chapter12/chapter_12_section_5.html to no avail. I successfully added application icons in AppleScript Studio before XCode, but things seemed to have moved around. A pointer would be appreciated. Thanks.

A quick update to my query. The icons that I created now appear in warning dialogs that the application brings up, etc., but not on the actual application icon in the Finder. Hopefully I am missing something simple. Thanks.

I had similar difficulties. I finally got my icon to show up in Finder and the alerts, then they disappeared from the Dock. I gave up worrying about it. Then, days later, I had to restart for Software Update – voilà, the icons show up everywhere.

Try cleaning your project and then rebuilding it. That should force the Finder to display the proper icon.

Jon

Whenever I click on the target, there’s nothing about Properties. If my application is called “iMaintain”, what would the target be called which I should get info for, and where could I find it? Thanks for any help you can give me!

I am using v 2.1 of project builder, so be warned that differences may exist compared to newest xcode version. In Project builder 2.1 you can:

  • Click on the “Targets” tab (in the vertical column of tabs between the screen’s windows). You can also select “Edit Active Target ‘MyAssProject’” from the Project menu.
  • Click on the target named the same as your app. Should be the only one unless you have multiple targets…it’ll have a target next to it :wink:
  • Click on “Application Icon” under ‘Info.plist entries’ in the window on the right. Assuming you’ve added it to your project already (Project > Add Files…), type in the name of your icon without the ‘.icns’ extension, as it is listed in your “Files” tab. If the file actually is valid, it should show up in the little window.
  • Save and build, then read on to get it to show up.

One note about icons, is that they are not automatically updated in the dock simply by changing them in your application. A record and copy of the current dock icons is stored in a special dock icon cache file. Restarting automatically purges the dock icons cache file, OR…

You can also do this without restarting, but you will still need to logout. Before you logout, delete the icons cache file. The cache file can be found “/Library/Caches
/com.apple.dock.iconcache.USER” Don’t worry about deleting it, it will be recreated automatically. Trash it and then logout/login. Your new icons should be there if all your ducks are actually in a row :smiley: .

Hope this helps…
j

Follow-ups to my previous post…

  1. Make sure that the name you type in for your icon file is case sensitive. I found out today (the hard way :x ) that project builder is erroneously NOT case sensitive when reading the icon name you provide. The icon will still display in the little preview window if the right characters are entered, even if they are not case sensitive. This is probably due to apple’s legacy of file names not being case sensitive. The built application, on the other hand, REQUIRES the file reference to be case sensitive to actually display it. Example: If your icon is named “MyIcon.icns”, you should type in “MyIcon”. But…if you type in “myIcon”, it will display in the target settings list, but not appear in the app itself when built. This should be something that project builder catches when you enter the file name, and it should not show up in the preview window. Oh, well…

  2. I wrote the previous post from recollection, and have since found that the icons cache file may not need to be deleted to enable you to see your icons after they are properly added to your project. Try the logout first without deleting it…and then delete it and logout again if it doesn’t work. As a test I… changed the icon of a folder, deleted that icon, and then tried to apply another icon. This made the first icon I changed it to appear. All I did was log out, and then the second icon was there. It may be more complex when working with an application with an internallized icon, so the cache file method may be required. I haven’t had the problem you’re having, so I can’t test this theory.

Good luck…
j

Once you have your .icns file in your project folder. Go to the project menu in Xcode then to add files. Add the .icns file. Next go to your target information and type in the name of the icon minus the ,icns in the application icon pref. Then put your executable file on your desktop or just move it from the build folder. Then in Xcode rebuild your app. Your executable will rebuild with your new icon.

How about just dragging the .icns file from the “Groups & Files” section of the Xcode project window to the “Icon file:” blank of the Active Target window?

No worries about case, deleting the “.icns” filename extension, etc.–Xcode takes care of everything for you automatically.

Hope this helps…