PDA

View Full Version : AppleScript dialog boxes




I'm a Mac
Apr 10, 2008, 08:51 PM
I am an applescripts newbie, and I want to create a dialog box with different answers for different choices. Here is my code:

display dialog "Something" buttons {"Click Here!", "Or here"} default button "Click Here!"
display dialog "Shouldn't you be doing something?" buttons {"Yes", "No"}

How do I make it so that it will display a different dialog depending on whether you click yes or no?



karenflower
Apr 10, 2008, 09:10 PM
Hi, here's an example of how to do that:

set question to display dialog "Shouldn't you be doing something?" buttons {"Yes", "No"} default button 2
set answer to button returned of question

if answer is equal to "Yes" then
display dialog "Do it, then!" buttons {"No thanks", "Ok"} default button 2
end if

if answer is equal to "No" then
display dialog "Good for you." buttons {"I know", "Really?"} default button 2
end if

Hope you can adapt it to your needs! :)