tmrScriptTimer.Interval Question...

Which hub software is the best? Where can I find script XXX? Discuss it here...(no, this is not for advertising your hub...)

Moderator: Moderators

Locked
Keeper
Posts: 7
Joined: 2003-01-09 20:05

tmrScriptTimer.Interval Question...

Post by Keeper » 2003-02-13 20:18

60000 is 1 minute. What is the maximum interval you can set for this? I'm looking to kick it off every hour. Thanks for any help in advance everybody :)

Atomic Jo
Posts: 62
Joined: 2003-01-04 03:50
Location: Québec, Canada
Contact:

Post by Atomic Jo » 2003-02-13 21:36

The maximum interval you can set seems to be 65535 milliseconds.

If you want one hour you must count the number of minute like this (this is an example)

Code: Select all

Dim iNbMinutes ' declare a global variable in the top of your script

Sub Main()
 tmrScriptTimer.Interval = 60000 ' one minute
 tmrScriptTimer.Enabled = true ' launch the timer
End Sub

Sub tmrScriptTimer_Timer ()
   iNbMinutes = int(iNbMinutes ) + 1

   If Int(iNbMinutes) > 60 Then  ' every hour
     ' Execute the code you want
   End If
End Sub

Keeper
Posts: 7
Joined: 2003-01-09 20:05

Post by Keeper » 2003-02-13 22:15

Thanks Atomic!!

I was trying tmrScriptTimer.Interval = 3600000

And any code I had after the line was not being executed. I then switched this to the last line in Main, and it seems to work, I was getting my test message every hour in the hub (for past two hours).

I like your idea much better, who knows what will happen with a huge number like above over long periods of time. Off to change the code :)

Locked