because the job has busy time
I have to delay some time before send the command
how to do this?
I have to delay some time before send the command
how to do this?
This forum is a read-only archive of the Gammon Software forum (2000–2026). No new posts can be made. Search the archive.
Posted by Jlake on Fri 29 Mar 2002 01:09 AM — 8 posts, 32,834 views.
const eEnabled = 1 ' is timer enabled?
const eOneShot = 4 ' if set, timer only fires once
const eReplace = 1024 ' replace existing timer of same name
Randomize timer
Sub DoAfter (iSecs, sCommand)
Dim iFlags, iHours, iMinutes, iSeconds, sName
'
' check time looks reasonable
'
If iSecs <= 0 then
World.Note "DoAfter called with zero or negative seconds"
Exit Sub
End If
If iSecs > 10000 then
World.Note "DoAfter called with more than 10000 seconds"
Exit Sub
End If
'
' work out a random name, loop until unique one found
'
Do
sName = "Timer_" & Int (32767 * Rnd (1) + 1)
Loop Until IsEmpty (World.GetTimerInfo (sName, 1))
'
' set flags
'
iFlags = eEnabled + eOneShot + eReplace
'
' convert supplied seconds to hours/minutes/seconds
'
iHours = Cint (iSecs / 3600)
iSecs = iSecs - (iHours * 3600)
iMinutes = Cint (iSecs / 60)
iSecs = iSecs - (iMinutes * 60)
'
' add the timer
'
World.AddTimer sName, iHours, iMinutes, iSecs, sCommand, iFlags, ""
End Sub