Sign in to follow this  
Followers 0
Diana (Cda)

[Resolved] What would we use to convert this variable to closest minutes?

5 posts in this topic

#1 ·  Posted (edited)

Hi! I'm finetuning an old script that is really working well; however, thought to add an audio prompt as follows to it. Here is the pertinent part of the script:

;---------------------------------------------------------------------------------------------------**************
;---------------------------------------------------------------------------------------------------**************
;----- "Sleep" period is set here:------------------------------------------------------------------**************
;  each 5 minutes = 300,000 / 600,000 = 10 minutes / 900,000 = 15 minutes / 1,200,000 = 20 minutes
$SleepPeriod = 900000
Sleep(1000)
$oSp.Speak("The sleep period is looped, for every " & $SleepPeriod & ", seconds ...")
;---------------------------------------------------------------------------------------------------**************
;---------------------------------------------------------------------------------------------------**************
;---------------------------------------------------------------------------------------------------**************
While 1
        Sleep($SleepPeriod)     ;  sleep time set with variable just above
    ;-------------------------------------------------------------------------------
I learned how to use round and floor this weekend so I know that I can use those if need be, but how do we get AI to convert that seconds into minutes so that the spoken representation is more logical?

Thanks much! ;)

Edited by Diana (Cda)

Share this post


Link to post
Share on other sites



Woops, wait a minute. Sorry, should have kept on going. I may have something. I'll try it again and see if this time I got something that works better. Back in a sec ... <g>

Share this post


Link to post
Share on other sites

$SleepPeriod/60000

since the sleep time is measured in miliseconds and there are 60 seconds/minute ;)

quote:

Sleep

--------------------------------------------------------------------------------

Pause script execution.

Sleep ( delay )

Parameters

delay Amount of time to pause (in milliseconds).


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Woops, wait a minute. Sorry, should have kept on going. I may have something. I'll try it again and see if this time I got something that works better. Back in a sec ... <g>

YES! Unbelievable. Sorry. I gave up a little too early. A few moments after I posted, a thought popped into my head to try something else that I'd seen in older scripts of mine when I got help for another issue. Turns out that I could modify the syntax and it _seems_ to be working! <g> Phew. Anyway, here's what I have.
;---------------------------------------------------------------------------------------------------**************
;---------------------------------------------------------------------------------------------------**************
;----- "Sleep" period is set here:------------------------------------------------------------------**************
;  each 5 minutes = 300,000 / 600,000 = 10 minutes / 900,000 = 15 minutes / 1,200,000 = 20 minutes
$SleepPeriod = 900000
;---------------------------------------------------------------------------------------------------**************
$timeDelay = $SleepPeriod/60000
Sleep(1000)
$oSp.Speak("The sleep period is looped, for every " & $timeDelay & ", minutes ...")
;---------------------------------------------------------------------------------------------------**************
;---------------------------------------------------------------------------------------------------**************
;---------------------------------------------------------------------------------------------------**************
I'm not sure, but I may have to use floor or round in there somewhere. I've made the sleep into a variable today because I was finding that it was too long a wait. Yet it would be easiest to have the script tell me each time the initial time it's set for to repeat. Every 20 minutes was too long but every 15 minutes, as shown here, would be better. But I may need longer or shorter periods of time in future so decided to make the script flexible.

It's a tray script that shuts off an app. Yet it reminds me every 15 minutes if I want to turn the app back on and the code is available through the tray to do that.

I'm sure there's a better way to do this, but fortunately, this works. Might help another newbie along the road somewhere. <g>

Thanks and cheers. ;)

Share this post


Link to post
Share on other sites

$SleepPeriod/60000

since the sleep time is measured in miliseconds and there are 60 seconds/minute :D

quote:

Hi, thank you!! Your reply and mine crossed in cyberspace and I saw it only after posting.

Thanks! Much appreciated. ;)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0