Re: A calculation question.
Re: A calculation question.
- Subject: Re: A calculation question.
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 01 May 2002 14:16:08 -0700
On 5/1/02 11:58 AM, "Kinsella, John R." <email@hidden> wrote:
>
set actionTime to text returned of (display dialog "Enter the time, in
>
seconds, you want this action to occur)
>
set startTime to StartTime + actionTime
>
>
--Here's where I'm kind of stuck I want to set theMinutes here and
>
theSeconds here
<snip>
>
I stuck
>
as to how to calculate the number of minutes and set that to a variable and
>
then get the number of remaining seconds and set that to a variable. Any
>
ideas??
Although it wouldn't be particularly difficult to write a routine to divide
by 60 and get the remainder, AppleScript has these functions built in:
set theMinutes to actionTime div 60
set theSeconds to actionTime mod 60
set stringVersion to ("" & theMinutes & " minutes and " & theSeconds &
" seconds")
or do whatever else you want with the variables. Don't forget to set them
'as string' or coerce to string with a preceding "" & as I did above if
that's how you need them.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.