12.10.10          If statement to test difference in time

 

set now [GETVAL %ATMSECOND]

set lastplay [GETVAL analog1]

 

# issue keymacro to play if 3 seconds since last

if {[expr $now - $lastplay] >= 3} then {

SETVAL analog1=$now

MCISEND {play warn from 1}

}

# reset analog1 if seconds > 60

if { $now <= 1 } then {

SETVAL analog1=$now

}