Dialog with icon

Displaying a dialogs with icon works fine when the following is run Script Editor.


display dialog "Hello" with icon stop
display dialog "Hello" with icon alias (POSIX file "/Applications/iTunes.app/Contents/Resources/iTunes.icns")

When I try to do the same in an Applescript application created with Xcode 3.0, it doesn’t work.


on clicked theObject
  display dialog "Hello" with icon stop
  -- Causes Applescript error "Can't make current application into type anything. (-1700)"
  display dialog "Hello" with icon alias (POSIX file "/Applications/iTunes.app/Contents/Resources/iTunes.icns")
  -- Displays a dialog without an icon
on clicked theObject

How can dialogs with icons be shown in an Applescript application?

AppleScript: 2.0.1
Browser: Firefox 3.0.5
Operating System: Mac OS X (10.5)

Hi,

AppleScript Studio overrides the display dialog method with its own one

from the documentation:
with icon anything
a string or integer that specifies the icon to display; for a string, the string must specify a TIFF file (without the .tiff extension) in the project that contains an icon image; for an integer, you can use the values 0, 1, or 2 to get system-supplied icons, or you can pass one of the enumerated values from Alert Type

Simple, you just create a new window in your mainmenu.nib file. Set it up the way you want with a text field that you can programatically set its text and add your program’s icon to it. Make sure it’s set to not automatically display when your application runs. Then when you want to display it you just “show window x” and you can attach it to your main program’s window with “attached to window x”.