• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Countdown Timer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Countdown Timer


  • Subject: Countdown Timer
  • From: "S. J. Cunningham" <email@hidden>
  • Date: Tue, 20 Oct 2015 18:36:27 -0400

I'm trying to implement a countdown timer.  At first I tried to do it with display alert but after the first display, the subsequent messages time out immediately.  The display dialog version works as expected, ie redisplays the message at regular intervals until the time is exhausted.  Here is the script.  Can anyone tell me why the display dialog version works and the display alert one doesn't?

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



Steve
------------------
OS X 10.6.8, AppleScript 2.1.2

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Countdown Timer
      • From: Iurista GmbH <email@hidden>
    • Re: Countdown Timer
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Calendar scripting
  • Next by Date: Re: Calendar scripting
  • Previous by thread: Re: Calendar scripting
  • Next by thread: Re: Countdown Timer
  • Index(es):
    • Date
    • Thread