Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Asu

macrumors member
Original poster
Apr 28, 2006
69
7
Hello,

I need to capture whether a dialog gave up or not.


tell application "Finder"
display dialog "Do you want to do something?" giving up after 10
if <did give up after 10> then
do one thing
else
do another thing
end if
end
tell

Thanks!

Asu
 

Red Menace

macrumors 6502a
May 29, 2011
583
230
Colorado, USA

The result of display dialog is a record
, with properties depending on the parameters used, so you can just query the desired value - for example:

Code:
set dialogResult to (display dialog "Do you want to do something?" giving up after 10)
if gave up of dialogResult then
    log "I gave up"
else
    log button returned of dialogResult
end if

Note that display dialog is a part of StandardAdditions, so you do not need to use the Finder.
 
  • Like
Reactions: Asu
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.