Icons in display dialog

Im pre-tiger so I think I need to utilise the “old fashioned way” but it may be a good resource to inject a theam or some personallity to the script interface.

Is your system pre-Tiger, PUNCH? The path to resource command was added in AppleScript 1.10 (Mac OS X version 10.4).

yeah, here at work, we’re still on Panther. I tested on a Tiger machine, and it worked great.

What can I do to make this work on Panther?

Try something like this instead, PUNCH (should work for both Tiger and pre-Tiger):

display dialog "Final collection." with icon POSIX file (POSIX path of (path to me) & "Contents/Resources/TheCheat.icns")

That didn’t work either.

I’ll explain what I’ve done.

I copied/pasted your line of code into a blank AS doc. Saved it as an app bundle, then I just double click the app. It displays the dialog, but doesn’t show the icon.

I then changed the name of my icon to applet.icns, and replaced the existing one in the resources folder. It DID change the icon of my app, but again, when I run the app, it displays the dialog, but no icon.

Thanx

I can’t test for this in Panther, PUNCH - but can I just check that you also changed the name of the icon in the script?

display dialog "Final collection." with icon POSIX file (POSIX path of (path to me) & "Contents/Resources/applet.icns")

If you’ve replaced the applet.icns file with another icon of the same name, this should now show the new icon, anyway:

display dialog "Final collection." with icon 1

(Using the path to an icon file is obviously more useful for displaying various different icons in dialogs.)

Insane.

Nothing worked. In fact, when I selected icon 1 it just gave me a generic finder looking icon. But hey, at least it displayed an icon at all eh?

Thnx

Checking into this in a little more detail, PUNCH, the release notes for AppleScript 1.10 (Mac OS X version 10.4) say:

This suggests that the ability to display alternative icons may have only been introduced in Tiger. So, for the moment, it looks like you’re stuck with the 3 standard icon options: stop (0), note (1) & caution (2). (It used to be possible to display an alternative icon by adding a new ‘cicn’ resource to an app - but things have changed a little since those days.)

This at least explains why your attempts didn’t alert us to a problem. :confused:

Hey kai, thanks for the info. We should be updating to Tiger in a couple months (prob. just in time for Leopard). I can wait till then to do the icon thing.

Thanks again

display dialog "blah." with icon POSIX file (POSIX path of (path to me) & "Contents/Resources/blah.icns")

Hmm. I’m using 10.4.6 and xcode 2.1 and I get an error message saying:
Can’t make file “blah/blah/blah.icns” into type anything

When I use

display dialog "Job folder already exists. Try again." attached to window "main" with icon path to resource "Doom.icns" in bundle (path to me)

I get the dialog sans icon. :(:(:frowning:

Oh, sure. The answer lies on page 2 of this thread. ( I just read the above after posting…)

display dialog "Job folder already exists. Try again." attached to window "main" with icon 1

gives me my application icon.

However, how do I get the cool applescript error icon? You know, the one with the Exclamation and little app icon combined?

Jaques! Such brilliance. :cool:

I had read that about the tiff, but didn’t realize that .icns were tiff formatted.
And thanks for helping out with the alert.

:confused: spudmnky