Using ComponentsTools extension, when any of its registered components is touched, reset the timer by disabling it and enabling it again, it will of course start from 0 ms:
And when it reaches 300000 ms without being reset, the application is closed:

Alternative solution without ComponentsTools is to set an event of “.Click” for each component but it needs the component to be clickable and that’s a very long process so just use this procedure to register a list of components at once at screen initialization:
Thanks to @Mohamed_Tamer for ComponentsTools!

