For a number of years now I have used the icons found within the CoreTypes.bundle for dialogs, scripts, slides & Self Service.
I thought it was common practice to use them, but after a few conversations at JNUC2015 it appears I was wrong.
So the below is a quick write up on them.
Contents
Location
The CoreTypes bundle is located at: “/System/Library/CoreServices/CoreTypes.bundle”
Once found right click the CoreTypes bundle & select “Show Package Contents”, then expand the “Contents” folder & then the “Resources” folder.
You should then find a plethora of .icns files, many of which you’ll recognise… Some you may not. Below are some more examples of the items you can find (on 10.10 at least):
I hope you’re already getting some inspiration from the above.
AppleScript Dialogs
AppleScript dialogs have 3 inbuilt icons, these are in the image above, & the images below show how to call them (this also applies to AppleScript calls from Bash via osascript):
However, you can also specify a particular apps icon (as shown below).
What’s cool about this is if an app icon is being called by it’s path & that path hasn’t changed across OS’s but the icon has, you’ll then get the correct icon for the OS it’s running on.
Incidentally, there is a great AppleScript in the second post of the thread here showing this.
Application Icons
As aluded to above, an apps icon can normally be found by right clicking the app bundle then clicking “Show Package Contents”, then expand the “Contents” folder & then the “Resources” folder.
You’ll notice that icons used by the app can often be found there.
If you’re unsure what is the apps icon, you can look at the value of the CFBundleIconFile key found within the Info.plist which is in turn found within the apps “Contents” folder.
Another method, as I was reminded by @peineke on the #jamfnation channel on the MacAdmins.org Slack, you can get the app icon by selecting the app you wish to grab the icon from then pressing cmd+i or in Finder selecting File > Get Info.
With the “Get Info” window open select the icon then press cmd+c.
Next open Preview & click File > New from Clipboard.
Preview should now open a new file with the copied icon.
Preference Panes
Preference Panes icons can often be found in the same way that an app’s icon can be found.
So navigate to the Preference Panes location, right click, choose “Show Package Contents”, navigate through “/Contents/Resources/”
Slides, Self Service & Munki Managed Software Center
Both Keynote & PowerPoint for Mac will accept the icons as is. However, be mindful when using with PowerPoint as your PC colleagues will not be able to see the file & so it may need to be converted to another format.
The JSS & Self Service will not accept the file as an icns file, so it will need to be converted to a 128 x 128 PNG as per:
Munki Managed Software Centre, like Self Service, also needs the files to be converted. This time into 300 x 300 PNG as per this wiki entry.
Opening the icons files & exporting via Preview is what I do, when needed. I’m sure that there are other means to do that.
Legality
I am not a lawyer, but would like to add a note of caution when using these icons as they are Apples.
Me personally? I’m comfortable with using the icons in the ways shown above.
I had the same kid-in-a-candy-shop moment in Windows a long time ago, when I first opened shell32.dll and found hundreds of icons lying within. Since Windows 8, however, I have no idea where Microsoft hides the bulk of its newer graphical resources.
See here: %windir%\System32\imageres.dll
Thanks for sharing this!
No problem.
For those that want to use osascript one liners in bash, use: osascript -e ‘tell application “SystemUIServer” to display dialog “Your text here” with icon file “:Macintosh HD:path:to:icon:file:here” as alias’