Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
AppleScript
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===User interaction=== AppleScript has several user interface options, including dialogs, alerts, and list of choices. (The character, produced by typing {{keypress|option|return}} in the Script Editor, denotes continuation of a single statement across multiple lines.) <syntaxhighlight lang="AppleScript"> -- Dialog set dialogReply to display dialog "Dialog Text" default answer "Text Answer" hidden answer false buttons {"Skip", "Okay", "Cancel"} default button "Okay" cancel button "Skip" with title "Dialog Window Title" with icon note giving up after 15 </syntaxhighlight> <syntaxhighlight lang="AppleScript"> -- Choose from list set chosenListItem to choose from list {"A", "B", "3"} with title "List Title" with prompt "Prompt Text" default items "B" OK button name "Looks Good!" cancel button name "Nope, try again" multiple selections allowed false with empty selection allowed </syntaxhighlight> <syntaxhighlight lang="AppleScript"> -- Alert set resultAlertReply to display alert "Alert Text" as warning buttons {"Skip", "Okay", "Cancel"} default button 2 cancel button 1 giving up after 2 </syntaxhighlight> Each user interaction method can return the values of buttons clicked, items chosen or text entered for further processing. For example: <syntaxhighlight lang="AppleScript"> display alert "Hello, world!" buttons {"Rudely decline", "Happily accept"} set theAnswer to button returned of the result if theAnswer is "Happily accept" then beep 5 else say "Piffle!" end if </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)