DISCLAIMER: I haven’t done anything I’m probably supposed to do about including a license, crediting Shane, etc. etc. in that file. I just dumped something that’s supposed to be for internal use on Dropbox, so please only use it for reference and understand that this is Shane’s code with just a few modifications I put in that may or may not be done correctly.
Edit: Note that I did not change any existing functions in the library, I only added new ones. So I did not add the custom icon to “display enhanced alert,” I added new functions “return enhanced alert” and “show returned alert,” and these allow the use of the custom icon.
It’s divided into the two parts so the script can modify variables in the alert before displaying it.
NSAlert by default will show the icon stored in YourApp/Contents/Resources/applet.icns. Save your custom images into that file. A tool like Icon Composer might help. For that to work add two lines of code to Shane’s Toolkit:
set appIcon to missing value -- located inside the on event handler before "tell alert"
and
its setIcon:appIcon – located inside the “tell alert” group.