This is 2 separated "optimization", one to prevent running the script when an animation is played.
The first one about the exeCount prevents running the script for each scene evaluation (aka each action, e.g user click on the object manager, select one object than another then another one, its pointless to execute your script each time)
It's a pretty dumb approach, I admit but its one 😛
Cheers,
Maxime.