Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to display an image in Cocoa-Applescript?

I made my script, but for a welcome message there is no image. How do I display one embeded in a dialog box with text underneath? I'm making this with ApplescriptEditor, not Xcode. Let's say this image was called "MCL.PNG". Thanks in advance.

Posted on Apr 7, 2013 5:40 AM

Reply
Question marked as Best reply

Posted on Apr 7, 2013 8:58 AM

Since you are using the AppleScript Editor, that would indicate that you are creating your user interface programmatically - what are you doing to create your dialog?

5 replies

Apr 7, 2013 9:16 AM in response to Apple_For_The_Win

A Cocoa-AppleScript uses the Cocoa frameworks, so that is what I thought you were talking about. A regular AppleScript display dialog can only use an icon, and it is positioned on the left without any text (unless the text is a part of the icon). If you have an icon file, you can use an alias or file reference using the with icon parameter for the command (see the Standard Additions scripting dictionary), for example:


display dialog"testing"with iconfile"path:to:your:icon"

Apr 7, 2013 1:34 PM in response to Apple_For_The_Win

Regular AppleScript just has a few basic kinds of dialogs - for anything more than that you will need to use Cocoa (or a third party utility that uses it).


If you are really using the Cocoa-AppleScript template, you have access to the various Cocoa methods that can be used to create your own windows and dialogs however you want, but without the use of the Interface Editor (in Xcode) you are stuck with doing it manually. It can be done, but depending on exactly what you are looking for, it won't be as simple as display dialog.

How to display an image in Cocoa-Applescript?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.