Thanks as always mikeywww. Yes I had an epiphany about the time math right after I posted my message so that in fact, I had it all figured it out around the time you replied.
Prior to that I couldn't figure where a big "40" was coming from in the math (like my result of "6210" seconds vs the expected 22:10). But when you view it as a simple base_10 number it makes sense; in my little image, AHK had actually done the simple math of value 110220 minus 104010. (Just like its Help says if you read it literally without expecting that EnvSub will be smart enough to deduce that its a time-based value... my bad. I guess.) The "extra 40" was because it was a tens-based number to AHK (i.e., 100), not a time-based number (i.e., 60). Thus: 40 more than expected. I had even briefly experimented with EnvSub prior to that and got the same +40 result, but finally read the v1 EnvHelp Help closely and noticed that I really had to tack on Seconds in this situation:
In my defense (lol) EnvSub is kind of wonky inasmuch as it can't simply be used as an equation. Instead it has to modify its Var1 (here, TimeTaken) with Var2 (TimeStart). So IOW I couldn't just say:
Like I did in my original (bad) example above. I had to say:
IOW I have to briefly turn TimeTaken into TimeStop, before making it what I actually want.
I see why you say "EnvSub does not always give the difference in seconds" ... curious wording at first glance. But I'm sure you just mean that there has to be at least one (new) minute's difference for it to be off by 40, as it were. (If it's just a few seconds' difference that didn't tick the minutes value, it will indeed show seconds properly.)
FWIW earlier I asked about the difference between v1.1 and v2 of AHK. I since looked into it more. I get the impression EnvSub is one of the "duck typing" places that v2 tries to do away with and, indeed, it looks like this keyword doesn't even exist in v2 (if I'm looking at the Documentation right).
Also FWIW I'm in my 60s and have seen a lot of weird coding stuff over the years. But it's the first time I saw a time value confused with a base_10 number.
Maybe I don't get around too much. Or maybe in my very limited amateur coding experience, none of it allowed duck typing.
As for the concept of "on", could you clear something up for me with finality. I had been assuming that the "on" is some sort of dedicated keyword (or whatever you want to call it) that AHK caused to be intimately associated with whatever hotkey was used in the script in question (here, F3). That's why I was saying I'm confused with how it can be associated with F3's state.
But as your new examples show, I believe you're saying that it is not associated with the specific hotkey and in fact may not even be a reserved keyword - it may just be a simple rando variable picked out of the air. (But chosen, of course, in a meaningful way since it's just a boolean being kicked back and forth between three possible values: yes, no, null.)
Pardon my prolonged confusion but this too is something that's impossible to search or google on. (Try googling for "AutoHotKey on". Or searching AHK documentation on "on". At first I just figured it was a dedicated keyword but I was searching wrong. Now I think it's a rando variable name, so of course search results would be a mess.)
Does that sound right?
Hey sorry for all my typing
Just reply if you have time and want to.
Thanks as always.
If anyone is interested, here's what my code looks like now:
The time math (start to stop) is spot on now.
Prior to that I couldn't figure where a big "40" was coming from in the math (like my result of "6210" seconds vs the expected 22:10). But when you view it as a simple base_10 number it makes sense; in my little image, AHK had actually done the simple math of value 110220 minus 104010. (Just like its Help says if you read it literally without expecting that EnvSub will be smart enough to deduce that its a time-based value... my bad. I guess.) The "extra 40" was because it was a tens-based number to AHK (i.e., 100), not a time-based number (i.e., 60). Thus: 40 more than expected. I had even briefly experimented with EnvSub prior to that and got the same +40 result, but finally read the v1 EnvHelp Help closely and noticed that I really had to tack on Seconds in this situation:
CODE:
EnvSub, TimeTaken, TimeStart, Seconds
In my defense (lol) EnvSub is kind of wonky inasmuch as it can't simply be used as an equation. Instead it has to modify its Var1 (here, TimeTaken) with Var2 (TimeStart). So IOW I couldn't just say:
CODE:
TimeTaken := TimeStop - TimeStart
Like I did in my original (bad) example above. I had to say:
CODE:
TimeTaken := A_Now
EnvSub, TimeTaken, TimeStart, Seconds
IOW I have to briefly turn TimeTaken into TimeStop, before making it what I actually want.
I see why you say "EnvSub does not always give the difference in seconds" ... curious wording at first glance. But I'm sure you just mean that there has to be at least one (new) minute's difference for it to be off by 40, as it were. (If it's just a few seconds' difference that didn't tick the minutes value, it will indeed show seconds properly.)
FWIW earlier I asked about the difference between v1.1 and v2 of AHK. I since looked into it more. I get the impression EnvSub is one of the "duck typing" places that v2 tries to do away with and, indeed, it looks like this keyword doesn't even exist in v2 (if I'm looking at the Documentation right).
Also FWIW I'm in my 60s and have seen a lot of weird coding stuff over the years. But it's the first time I saw a time value confused with a base_10 number.
Maybe I don't get around too much. Or maybe in my very limited amateur coding experience, none of it allowed duck typing.
As for the concept of "on", could you clear something up for me with finality. I had been assuming that the "on" is some sort of dedicated keyword (or whatever you want to call it) that AHK caused to be intimately associated with whatever hotkey was used in the script in question (here, F3). That's why I was saying I'm confused with how it can be associated with F3's state.
But as your new examples show, I believe you're saying that it is not associated with the specific hotkey and in fact may not even be a reserved keyword - it may just be a simple rando variable picked out of the air. (But chosen, of course, in a meaningful way since it's just a boolean being kicked back and forth between three possible values: yes, no, null.)
Pardon my prolonged confusion but this too is something that's impossible to search or google on. (Try googling for "AutoHotKey on". Or searching AHK documentation on "on". At first I just figured it was a dedicated keyword but I was searching wrong. Now I think it's a rando variable name, so of course search results would be a mess.)
Does that sound right?
Hey sorry for all my typing

Thanks as always.
If anyone is interested, here's what my code looks like now:
CODE:
F3:: ; F3 to toggle
If on := !on {
ToolTip Running
SoundBeep 1500
Send #!{PrintScreen}
LoopCount = 0 ; Initialize
TimeStart := A_Now
FormatTime, TimeStartS,, MM-dd-yy HH:mm:ss
} Else {
ToolTip
FormatTime, TimeStopS,, MM-dd-yy HH:mm:ss
TimeTaken := TimeStop
EnvSub, TimeTaken, TimeStart, Seconds
FormatTime, TimeTakenS, %TimeTaken%, HH:mm:ss
SecsPerLoop := format( "{:.4f}", TimeTaken / LoopCount )
MsgBox, 0, Heads up, %TimeStopS% minus `n%TimeStartS% equals `n%TimeTaken% seconds for %LoopCount% loops or `n%SecsPerLoop% seconds per loop
}
While on {
Loop % 10000 / 500 ; I keep playing with these values as I test ... YMMV
Sleep 500 * on
If on
Send {F5}
Loop % 10000 / 500 ; ditto
Sleep 500 * on
If on
Send #!{PrintScreen}
LoopCount++
SoundBeep 100
TimeStop := A_Now
}
Return
The time math (start to stop) is spot on now.
Statistics: Posted by Mike_Fay — Today, 09:50