Custom icon in 'Run Only' Script Bundle

I have created an AppleScript which includes a custom icon for a display dialog. This works fine when I save the script as a Script bundle, and run the script from TextWrangler. However, when I save the same script as a Script bundle with the Run Only box checked, I get an error message in TextWrangler to the effect that;

…Contents:Resources:brush.icns wasn’t found.

the respective dialog text in the script is as follows, and prior to saving, the Bundle Contents drawer in Script editor contains;

brush.icns
description.rtfd
Scripts (folder)

display dialog "Some text." with icon alias ((path to me) & "Contents:Resources:brush.icns" as string) buttons {"Thank You"} default button {"Thank You"}

I have tried creating a folder called Contents in the Bundle Contents drawer, and putting the icon in that, but still no joy. I take it that when I drag and drop a custom icon onto the Script Editor contents drawer, the icon itself is actually copied, or is the problem that this only creates an alias reference to the original file? Could it be that the path to the icon file in the script needs modification?

Note that I wish to distribute the script with the custom dialog icon included (preferably as a Run Only script bundle).

Many thanks if you can help.

David

David - I have to ask – when you saved it as Run Only did you remember to put the brush.icns in the Resources folder of the new script?

Tom

Operating System: Mac OS X (10.5)

Hi Tom,

It never even occurred to me to check the Package Contents of the saved script file, as I assumed the custom icon would be saved automatically :rolleyes:

Thank you greatly, all is now working. Another lesson in life for me…never assume :slight_smile:

David