Icons in "display dialog"....

I know of all the default icons you can do with display dialog such as…

display dialog "" with icon 0

will return a stop sign with an exclimation point,

display dialog "" with icon 1

will return a applescript icon, and

display dialog "" with icon 2

will return a warning sign, but i was wondering if you can make custom icons instead of those default ones
any help will be much appriciated


I’m not sure about your question but check out this script by Kai Edwards

{{path to "csrv" as Unicode text, {"Finder.app", {{"Which do you prefer?", "generalpref.icns"}, {"What do you want to find?", "find.icns"}, {"For your information.", "info.icns"}, {"Make a new folder?", "new_folder.icns"}, {"Is that a smart folder?", "SmartFolder.icns"}}}, {"Jar Launcher.app", {{"Fancy a cuppa?", "JarLauncher.icns"}}}, {"Crash Reporter.app", {{"Watch out!", "CrashReporter.icns"}}}, {"Help Viewer.app", {{"Help!", "HelpViewer.icns"}}}, {"BOMArchiveHelper.app", {{"Zip me up...", "bah.icns"}}}, {"Certificate Assistant.app", {{"That you, Jeeves?", "Certificate Assistant.icns"}}}, {"Classic Startup.app", {{"Remember me?", "Classic.icns"}}}, {"Conflict Resolver.app", {{"Round we go!", "Sync Services Icon.icns"}}}, {"Dock.app", {{"Just like to say...", "dockling.icns"}, {"...what a great show!", "Dock.icns"}, {"Widget, anyone?", "widget.icns"}}}, {"MirrorAgent.app", {{"I foresee a bright future...", "iDiskGenericIcon.icns"}}}, {"Network Diagnostics.app", {{"...just needs a little work...", "Network Diagnostics.icns"}}}, {"Software Update.app", {{"...and it'll be just fine.", "Software Update.icns"}}}}, {path to "apps" as Unicode text, {"Dashboard.app", {{"Weather looks good.", "Dashboard.icns"}}}, {"Calculator.app", {{"Just trying to figure out...", "Calculator.icns"}}}, {"Chess.app", {{"...my next move.", "chess.icns"}}}, {"Image Capture.app", {{"Smile!", "ImageCapture.icns"}}}, {"Preview.app", {{"Great shot!", "preview.icns"}}}, {"iCal.app", {{"What's the date?", "App.icns"}}}, {"Dictionary.app", {{"What did you say?", "Dictionary.icns"}}}, {"Utilities:Keychain Access.app", {{"Looks just like you.", "vCard.icns"}, {"Anyone seen my keys?", "Keychain.icns"}}}, {"Utilities:Audio MIDI Setup.app", {{"Ah - there they are!", "AudioMIDISetup.icns"}}}, {"Utilities:Terminal.app", {{"Anything good on TV?", "icon.icns"}}}, {"Utilities:Activity Monitor.app", {{"Yeah - this bit's gripping.", "ActivityMonitor.icns"}}}, {"Utilities:Migration Assistant.app", {{"No overtaking.", "MigrateAsst.icns"}}}, {"iMovie.app", {{"That's a wrap.", "app.icns"}, {"G'night, folks.", "iMovie.icns"}}}}}

repeat with x in result
	set a to x's item 1
	repeat with y in rest of x
		set b to y's item 1
		repeat with z in y's item 2
				display dialog z's item 1 with icon a & b & ¬
					":Contents:Resources:" & z's item 2 as alias giving up after 2
			on error number n
				if n is -128 then error number n
			end try
		end repeat
	end repeat
end repeat

heres the link to the thread:


Hey There,

Another option when using the resources folder in a app bundle.

display dialog "" with icon path to resource "iconName.icns" in bundle (path to me)

The basic icons can also be called by name

display dialog "" with icon applet

display dialog "" with icon stop

display dialog "" with icon caution


Useful script! It’s not mine, i don’t remember where I found it

to show_icons over k for t
	set p to (path to "csrv")'s POSIX path & "CoreTypes.bundle/Contents/Resources/"
	set l to list folder POSIX file p without invisibles
	set e to count l
	set q to true
	set b to "+"
	set m to 1
		set f to l's item m
		set i to POSIX file (p & f)
		set s to ((size of (info for i)) + 500) div 1000
		if f ends with ".icns" and s > k then
			set d to f's text 1 thru -6 & return & s & " KB" & return & i
			if not gave up of (display dialog d buttons {"Cancel", "Pause"} default button 2 with icon i giving up after t) then ¬
				set b to button returned of (display dialog d buttons {"Cancel", "-", "+"} default button b with icon i)
			if q then set q to false
		end if
		set m to m + (b & 1)
		if m > e then
			if q then return beep
			set m to 1
		else if m < 1 then
			set m to e
		end if
	end repeat
end show_icons

show_icons over 10 for 1 (* over size (KB), for time (seconds) *)

Is this suppose to reference the icon of the script? It is not working for me if it is. I am able to reference a bundled script but it doesn’t run directly with my script launcher unfortunately.

It sees “applet” as a variable

Yes, that icon applet is a slipup. The correct text equivalent is icon note. It’s the icon of the current app, i.e. the applet icon when that’s what’s running. When the applet has a custom icon it will be that custom icon.

Wonderful thanks for that information, that is very helpful.

Is there a way to have it reference to itself as a script (i.e. the scripts icon without being a script bundle)?

As you know this always references to whatever application executes it, so if the script is run by QuickSilver you see QuickSilvers icon in the dialog, or Launchbars, QuicKeys etc. Or if run in AppleScript you get AppleScripts icon since that is what ran the script.

display dialog "" with icon note

Tom’s code shows how. EasyFind finds two applet icons:

The .scpt document icon is an Editor resource:

Edit: hmm. That second applet.icns path got truncated.

Thank you for the replies, I feel like I am getting closer. Sorry I wasn’t more clear, if I “Get Info” on a file and copy and paste an icon image to a script if I zip and email that script to someone the script icon goes with it to the other Mac.

So if another person runs the script from a script launcher like QuickSilver, LaunchBar, QuicKeys etc how do you have it show the icon you attached with the script (not script bundle). I can’t find the path to the icon even when I show invisibles on my mac. The only time I see an Icon anything is when I attach an Icon to a folder and then it “Icon” shows up as an invisible file in the folder you attach the icon to.

I hope that makes more sense what I am trying to do. I might have to use invisibles or something to do this. When I save the script as an application and use “with icon note” it displays the icon that was copy and pasted to the app as desired even though it is not in a resource folder. I am trying to get this behavior to happen when attached to a script but run by another app.

I have spent the last three hours working on this but my google skill must stink. The closest thing I could find related to where the icon is stored is here but doesn’t really talk about when copy and pasted http://interestinglythere.com/articles/systemicons/

I am thinking something like this

set myPath to path to me

display dialog "open_image" with title "My Test Call" with icon note of myPath buttons {"Done"} cancel button "Done"

Thank you for the useful info I will be putting that to good use in the future.

You’ll find an icon pasted onto a bundle in the same relative position, i.e. next to the Contents folder.
Some observations:

  • it is visible when you select ‘show package contents’ in Finder
  • it is NOT visible when you drill down into that package using Folderglance
  • it is NOT visible when you open the package with Folderglance
  • it’s kind is “Finder document”
  • mdls cannot find it:

Hypothesis: Finder is using some legacy stuff when you paste an icon in a Get info window.
I believe the ‘modern way’ is to put an .icns file into the bundle’s Resources folder, although that seems not to work with a .scptd bundle.

[guesswork] Finder is the only app that knows about that pasted icon. When some other app wants to display the script’s icon, it must ask Finder for an icon - and what it’s asking for is the icon for this filetype, not the icon of the actual file, so you’ll see a generic icon, not the one you pasted. [/guesswork] :stuck_out_tongue:

I was able to open it but it still referenced to a icon file in the apps Resources file “tongue.icns”. It helped to see how you used the “path to me”. I saved the script you made as a script and changed the icon, I want to reference the icon that is part of the script but there is no package to reference (which makes sense if it isn’t a bundle or an app).

I ran into an issue with script bundles working properly with some third party apps that run them.

So in the case of this link I would like to have the tomato with the clock show in the dialog box when the script runs but still keep the script the extension .scpt


Thanks very much for you persistence, I hope I am not frustrating you at all, each post has helped.

Good stuff thanks Tom. I thought about doing something like that too, thanks for all the time and help, much appreciated!

Not to take a left turn, but did you make the icon file through copy and past in Icon Composer?

That is great, thanks for the info, this will save me several extra steps I have been going through. Glad I asked.

It’s a lot easier just to specify an image like this:

display dialog "Hello" buttons {"Cancel", "Continue"} with icon {"/Users/" & (do shell script "whoami") & "/path/to/picture.jpg"}


do shell script

part just makes it work, even if you send it to your friends, although I would then recommend downloading the image from the internet with curl and placing it in a folder. Sorry if it is a bit confusing

I am confused. That code just doesn’t look right - it has several syntax anomalies, and one actual error: the image should be an icon.
But, strangely, the code works when given an icon.

The anomalies:

  • with icon should be with icon file, when you want to use your own icon
  • path should be HFS, not POSIX
  • the braces around the path string are a mystery; braces = list, right?

I think this is correct, and it also eliminates the costly do shell:

display dialog "Hello" buttons {"Cancel", "Continue"} with icon file ((path to home folder as text) & "path:to:icon.icns")