I thought an on quit handler would work in this instance, but its not the same function I am after. Or maybe it is, but I don’t know how to trump the on quit handler if some other handler is called?
What I am looking for is a dialog box that times out without user intervention after 30 seconds.
That part is simple: – dialog here – buttons {“Yes”, “No”} default button 2 with icon 1 giving up after 30
But I am also looking for a way to have the script perform a function if it happens to give up?
The script I am using is an application script used as a startup item. I am sorry for posting such a simple question, but I am lost again
set _dialog to display dialog "" buttons {"Yes", "No"} default button 2 with icon 1 giving up after 30
if gave up of _dialog then
-- do something
end if
The result of a dialog reply is a record with three possible but not always present properties:
button returned (unicode text) – always returned
gave up (boolean)
text returned (unicode text)
set D to display dialog "text of dialog" buttons {"Cancel", "What", "OK"}
set DD to properties of D
--> {button returned:"OK"}; or could be "What" but "Cancel" terminates the script.
set E to display dialog "Enter an Answer" default answer ""
set DE to properties of E
--> {text returned:"Answer", button returned:"OK"}
set F to display dialog "I'm waiting" giving up after 2
set DF to properties of F
--> {button returned:"", gave up:true}
set G to display dialog "Hi there" giving up after 2 default answer "Hi back" buttons {"OK"} default button 1
set DG to properties of G
--> {text returned:"Hi back", button returned:"", gave up:true}