Re: Seconds until next tock
Re: Seconds until next tock
- Subject: Re: Seconds until next tock
- From: Gil Dawson via AppleScript-Users <email@hidden>
- Date: Sun, 18 Aug 2019 17:51:02 -0700
Thanks, Maik.
I appreciate the suggestion. I have long waited to check out GitHub. Perhaps
now is the time.
I think I may have neglected to emphasize that, in the list of four times:
>> (*The current time is 3:26:43 PM*)
>> (*The current time is 3:27:00 PM*)
>> (*The current time is 3:27:20 PM*)
>> (*The current time is 3:27:40 PM*)
I was interested in generating the last three, each of which ends in a multiple
of 20 seconds, and not the first, which does not.
--Gil
> On Aug 18, 2019, at 5:23 AM, Maik Waschfeld
> <email@hidden> wrote:
>
> Hi Gil,
>
> If it’s enough for you to get a countdown-timer in a separate window, try
> Figure 53’s „QDisplay“ from their Github-repository at
> <https://github.com/Figure53/QDisplay <https://github.com/Figure53/QDisplay>>.
>
> For this, you just need a one-time message when starting the track to
> QDisplay with the time in seconds to count down.
>
> You have to get the "seconds of the track*)“ (see below) from the track’s
> properties.
>
> — snapp
> set the_qD_Message to „Track’s end in:"
> set the_timeRemaining to (seconds of the track*)
>
> tell application id "com.figure53.QDisplay"
> set message to the_qD_Message
> set timeRemaining to the_timeRemaining
> end tell
> — snapp END
>
>
> With kindest regards…
> …Maik Waschfeld
>
> (sent from my MBAir11)
>
>
>> Am 18.08.2019 um 00:45 schrieb Gil Dawson via AppleScript-Users
>> <email@hidden
>> <mailto:email@hidden>>:
>>
>> Hi--
>>
>> I needed something to execute at a regular interval, on the rounded interval
>> seconds.
>>
>> --Gil
>>
>>
>> repeat 4 times
>> log "The current time is " & time string of (current date)
>> delay SecondsUntilNextTock(20, 3)
>> end repeat
>>
>>
>> -->
>> (*The current time is 3:26:43 PM*)
>> (*The current time is 3:27:00 PM*)
>> (*The current time is 3:27:20 PM*)
>> (*The current time is 3:27:40 PM*)
>>
>> on SecondsUntilNextTock(Tock, MinRunSecs)
>> set Now to current date
>> set NowSec to ((hours of Now) * hours) + ((minutes of Now) * minutes) +
>> (seconds of Now)
>> set LastTock to (NowSec div Tock) * Tock
>> set LastTockTime to Now - NowSec + LastTock
>> set NextTockTime to LastTockTime + Tock
>> set SecsUntilNextTock to NextTockTime - Now
>> repeat until SecsUntilNextTock ≥ MinRunSecs -- if the next execution
>> would come too soon...
>> set NextTockTime to NextTockTime + Tock --skip an interval
>> set SecsUntilNextTock to NextTockTime - Now
>> end repeat
>> return SecsUntilNextTock
>> end SecondsUntilNextTock
>>
>
_______________________________________________
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