set userCanceled to -128
set moduleName to "Testing"
set simulationDelay to 30
copy simulationDelay to timeLeft
set refreshDelay to 3
set repeatCount to (simulationDelay / refreshDelay) as integer
try
repeat repeatCount times
-- display dialog version: works
set resultDialogReply to display dialog "Remaining Delay " & timeLeft & ¬
" Seconds" buttons {"Proceed Now"} ¬
cancel button ¬
"Proceed Now" with title "Simulating " & moduleName ¬
giving up after refreshDelay
----------------------------
-- display alert version: doesn't work
(*
set resultAlertReply to display alert "Simulating " & moduleName ¬
message "Simulation delay: " & timeLeft & ¬
" seconds" buttons {"Proceed Now"} ¬
cancel button ¬
"Proceed Now" giving up after refreshDelay
*)
----------------------------
set timeLeft to timeLeft - refreshDelay
if timeLeft ≤ 0 then
exit repeat
end if
end repeat
on error errMsg number errNum
if errNum = userCanceled then return
end try