Re: How can I simplify the math in this script?
Re: How can I simplify the math in this script?
- Subject: Re: How can I simplify the math in this script?
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 16 Jun 2008 20:25:37 -0400
property Launch3G : date "Friday, July 11, 2008 6:00:00 PM"
set unitSizes to {weeks, days, hours, minutes, 1}
set unitNames to {"weeks", "days", "hours", "minutes", "seconds"}
repeat
set timeLeft to Launch3G - (current date)
set resultString to ""
repeat with i from 1 to count (unitSizes)
set unitSize to item i of unitSizes
set unitName to item i of unitNames
set unitCount to floor (timeLeft / unitSize)
set timeLeft to timeLeft mod unitSize
if length of resultString is 0 then
set resultString to "iPhone 3G will be launched in exactly "
else
set resultString to resultString & ", "
end if
set resultString to resultString & " " & (text 1 through -3 of
(unitCount as string)) & " " & unitName
end repeat
display dialog (resultString & ".") giving up after 1
end repeat
Although the blinking dialog box makes a very annoying countdown timer. :)
_______________________________________________
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