Dialog Buttons in AppleScript

I noticed that in some dialog boxes, there are three buttons: one normal, one shaded blue, and one with a blue outline. I also noticed that pressing the return key selects the shaded button and pressing the space key selects the outlined button.

My question is this: how do I create shaded buttons in a dialog using AppleScript?

Screenshot:
http://files.me.com/antonioohama/8ekfnd

Custom MacBook Pro, Mac OS X (10.6.3), 2.26 GHz Intel Core Two Duo, 2 GB 1067 MHx DDR3 Memory, v10.6.3 Build 10D573

Posted on Apr 23, 2010 7:10 PM

Reply
8 replies

Apr 24, 2010 8:39 PM in response to Kappy

The default button (the one that gets pressed by using the return key) is different from the one that has the current focus (the one that changes when pressing tab, and gets pressed by using the space key). Unlike the regular dialog, which doesn't give focus to any of the buttons, the display alert dialog does set the focus to the rightmost button, for example

display alert "Alert" message "See the pretty buttons!" buttons {"Cancel", "OK", "Some other button"} cancel button "Cancel" default button "OK"

Apr 24, 2010 2:56 PM in response to TC (Techno Cat)

XCode is found in the Developers folder. If you need programming help I suggest you join the ADC as a free member - developer.apple.com. Searching Google will help you find other documentation sources. You can purchase books at Amazon.com. There is a Developer forum that's part of the Apple Discussions.

AppleScript does not make outlined buttons.

Apr 24, 2010 3:09 PM in response to TC (Techno Cat)

The outlined button is the one that is currently in focus (you can change the focus by tabbing through the various items). The standard AppleScript display dialog doesn't set the focus to any particular button, but display alert sets the focus to the last button (the one on the right). I think that is about as close as you are going to get without creating your own dialogs (with Xcode).

Apr 24, 2010 6:57 PM in response to red_menace

You can designate which dialog button is the default. The command reference provides this information:

*A list of up to three button names*.

+Default Value+:
If you don’t specify any buttons, by default, Cancel and OK buttons are shown, with the OK button set as the default button.

If you specify any buttons, there is no default or cancel button unless you use the following parameters to specify them.

+default button+ (text | integer)
The name or number of the default button. This button is highlighted, and will be pressed if the user presses the Return or Enter key.

+Default Value+:
If there are no buttons specified using buttons, the OK button. Otherwise, there is no default button.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Dialog Buttons in AppleScript

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