Extract App Resource Icons with AppleScript
Whether I'm preparing for a demo or writing an article, blog post, book, or technical documentation, I often find myself performing the same set of repetitive steps. I need to navigate into an app's packaged resources folder, find one or more icon files, occasionally convert them to PNG and scale them, and add them to my document, Keynote presentation, etc. Fortunately, this doesn't need to be a manual process each time, thanks to the following AppleScript.
Creating the Script
1. Launch AppleScript Editor (in /Applications/Utilities) and create a new script document.
2. Enter the following script into the document.
NOTE: If you have any trouble following along, you can download the completed script here.
3. Run the script from AppleScript Editor, save it as an app, or add it to your script menu.
Running the Script
When you run the script, you're first asked to select an app from which to extract icons. Make your selection and click Choose.
The script looks inside the app's /Contents/Resources folder for any files with an extension of .icns. If multiple files are found, it allows you to select the ones you want to extract. The default is all of them.
Next, the script gives you the option to extract the .icns files themselves, or PNG versions. Click the button to make your choice.
If you click the PNG button, then you're given a choice of sizes to create. You might not need the full sized icons, for example. You might only need 256x256 icons.
Depending on the options you chose, the script extracts the .icns files, or it converts the .icns files to PNG and scales them, as needed. You're notified when the icons have been extracted, and they're displayed in the Finder for you. Now you can simply drag them to your document, presentation, file, etc., and you're good to go! Happy Scripting!
Subscribe to Newsletter
Software Updatesmore updates
- Dropbox adds support for TouchID
- YouTube for iOS gets updated with full support for iPhone 6 and 6 Plus
- iOS 8.0.1 update now available (Updated -- Don't update!)
- NFL Mobile updated for 2014 Season with new Fantasy Football features, NFL Now integration
- Yahoo Mail improves email inbox searching with new filtering options
- Ember for Mac gains 'hugely-requested' screen recording feature