I'm assuming that #2 is not relevant to a period of -1 or to my post...
The entire quote is only
indirectly relevant; "as
often as specified" implies that the timer is a repeating one. It was most likely written before run-once timers were added, but it also fails to take into account that an existing timer's period can be reset to a
smaller period (probably because it is less common or less likely to be a problem).
It does not matter what the period is relative to how long the subroutine runs, only whether or not the subroutine is
still running when the period expires.
- If the timer is a repeating one and the subroutine duration exceeds the period, the subroutine will not be relaunched at the expected time because it is still running.
- If the timer is a repeating one but the subroutine finishes before the period expires, the subroutine may be relaunched.
- Whether or not the timer is a repeating one, if the period is reset and the new period expires while the subroutine is still running (regardless of how long ago it started), the subroutine will not be relaunched at the expected time.
I assume you're referring to my question
No, I was referring to the titular issue; whether "the second
SetTimer "MsgBox1", -1 creates a new timer instead of resetting the existing timer" has nothing to do with whether the subroutine is still running. As I think you had already concluded, if you pass the same function name in both calls (and that function is not a closure), the second call will
never create a new timer. (However, if the timer subroutine has already been called and returned, you probably won't notice the difference.)
KeyHistory is the only way to determine which timers are enabled, unless you keep track of them yourself.