I have the following script on a machine with several different partitions on it to allert the user to what start-up disk they are using. it runs at startup of the Mac OS. We use 10.9.x
delay 5
tell application "Finder"
activate
set visible of every process whose visible is true and name is not "Finder" to false
end tell
--
tell application "Finder" to display alert " Please VARIFY.
Is this indeed the Start-up disk you want to use!
If not restart after selecting the correct disk.
Your current start-up disk is:
----> " & (get name of startup disk)
--
tell application "Finder"
if name of startup disk is "NameOfDisk" then display alert "PAY ATTENTION!.
You are using the Back-Up Start-up disk, namely:
----> " & (get name of startup disk) & " <----
Are you sure or do you need to restart on the other disk?"
end tell
delay 1
tell application "Finder"
activate
set visible of every process whose visible is false and name is not "Finder" to true
delay 2
end tell
The problem is that if the OK box is not clicked soon enough the script hangs and prevents shutdown if the user does not notice it.
Is there a way to avoid this? I would rather not have the dialogue box close down automatically as I like the user to be aware as to what disk is active to prevent mistakes.
Model: MBP 10.9.x
AppleScript: 2.6 (152)
Browser: Safari 537.73.11
Operating System: Mac OS X (10.8)
It’s described with details in AppleScript Language Guide as :
display dialog
Displays a dialog containing a message, one to three buttons, and optionally an icon and a field in which the user can enter text.
set alertResult to display alert "Insert generic warning here." ¬
buttons {"Cancel", "OK"} as warning ¬
default button "Cancel" cancel button "Cancel" giving up after 5
Syntax
display dialog text default answer text
hidden answer boolean buttons list
default button labelSpecifier cancel button labelSpecifier with title text
with icon resourceSpecifier
required optional optional optional optional optional optional optional
Commands Reference
 with icon
with icon
giving up after
Parameters
text
iconTypeSpecifier fileSpecifier integer
optional optional optional
The dialog text, which is displayed in emphasized system font.
default answer text (page 123)
The initial contents of an editable text field. This edit field is not present unless this parameter is present; to have the field present but blank, specify an empty string: default answer ""
Default Value:
None; there is no edit field.
hidden answer boolean (page 102)
If true, any text in the edit field is obscured as in a password dialog: each character is displayed as a bullet.
Default Value:
false: text in the edit field is shown in cleartext. buttons list (page 112) (of text (page 123))
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 (page 123) | integer (page 110))
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.
cancel button (text (page 123) | integer (page 110))
The name or number of the cancel button. This button will be pressed if the user presses the Escape key or Command-period.
Default Value:
If there are no buttons specified using buttons, the Cancel button. Otherwise, there is no cancel button.

Commands Reference
with title text (page 123) The dialog window title.
Default Value:
None; no title is displayed.
with icon (text (page 123) | integer (page 110))
The resource name or ID of the icon to display.
with icon (stop | note | caution )
The type of icon to show. You may specify one of the following constants:
stop (or 0): Shows a stop icon
note (or 1): Shows the application icon
caution (or 2): Shows a warning icon, badged with the application icon
with icon (alias (page 98) | file (page 110))
An alias or file specifier that specifies a .icns file.
giving up after integer (page 110)
The number of seconds to wait before automatically dismissing the dialog.
Default Value:
None; the dialog will wait until the user presses a button.
I think i know about this, but think it does not solve my problem. Or do I understand the function incorrectly?
I seem to understand that it will close the dialog box automatically after x seconds, and this is not what I want. I want the script not to hang and give error massages later if the box does not get ticked in time. I also want the user to tick the box and for it to not automatically close.
The trick is to set an huge amount of seconds for by default AS gives up after a given time. So to avoid the error you encounter just put away the deadline by setting the give up delay to some hours for instance (1 hour = 1 * 60 * 60 seconds). HTH.
When sending a command to an application, AppleScript allows two minutes for the application to signal the completion of the task. If there’s no reponse within that time, a timeout error is generated. (The response to a command to display a dialog is whatever the user did with the dialog.) You can change the time allowed with a ‘with timeout’ statement:
with timeout of 900 seconds -- Allow fifteen minutes for a response.
tell application "Finder" to display alert " Please VARIFY." -- "VERIFY"?
end timeout
-- Or:
with timeout of (15 * minutes) seconds
tell application "Finder" to display alert " Please VARIFY."
end timeout
‘giving up after’ is a dialog parameter which causes the dialog to dismiss itself after a certain time. A ‘with timeout’ statement sets the time AppleScript is prepared to wait for applications to respond to commands within it.
Circumlocationing it a little, I added some code to see to that you can test for the conditon when parsing the result of the dialog.
I have defined dialog to give up one second before the timeout, then I get the result either as gave up: true or with a button returned as “”, which I use here.
property slack : 120
tell application "Finder"
with timeout of slack seconds
set btn to button returned of (display dialog " This is a timeout test." giving up after (slack - 1))
end timeout
# you'd add other branches to the if test here, to deal with the ok button for instance:
# if btn is "Ok" ...
# else if .. else if btn is "" ...
if btn is "" then # gave up
error number -128 # we quit
# but you could set a variable to identify that the user neglected to answer to the dialog here.
end if
end tell