• 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
A calculation question.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A calculation question.


  • Subject: A calculation question.
  • From: "Kinsella, John R." <email@hidden>
  • Date: Wed, 01 May 2002 13:58:07 -0500

Here's another though one for the list. I need to do some calculation. I
have users inputting the time in seconds that they want something to happen.
What I need to do is figure out how many minutes and seconds that translates
into and get BOTH of those numbers (the minutes and seconds) out of the
repeat loop to use elsewhere.

set slideNumber to 3
set startTime to 0
repeat with i from 1 to slideNumber
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

write theMinutes and theSeconds to a test file
end repeat


I could get around this by doing something like this inside the repeat loop
if timecode is less than "60" then
set timevar to "seconds"
end if
if timecode is less than or equal to "60" then
set timevar to "1"
end if
if timecode is less than or equal to "120" then
set timevar to "2"
end if

if timevar is 1 then
set timecalc to timevar * 60
set timesecond to timecode - timecalc
write timevar (the minutes) to a file
write timesecond (the seconds) to a file.
end if

and so on, but that builds in immediate limitations in the script. 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??
John Kinsella
-------------
"The surest way to corrupt a youth is to teach him to hold in higher regard
those who think alike rather than those who think differently."
--Nietzsche
_______________________________________________
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.

  • Prev by Date: Re: URL Access - Upload???
  • Next by Date: Re: writing data to a file
  • Previous by thread: Re: integers which just won't be round
  • Next by thread: Re: A calculation question.
  • Index(es):
    • Date
    • Thread