Jump to content
Sign in to follow this  
ParoXsitiC

Timer for Active Window

Recommended Posts

ParoXsitiC

I am in need of a script that will start a timer as soon as a window titled something like "Start Time Now" becomes active (winactive)...the timer will continuously run while the window is active, as soon as the window is no longer active the timer will pause, and wait until it's active again to begin its clock.

The time should be stored in a variable that can be used to submit to a site.

I was thinking of ways to be constantly running the script, and then when its out of focus, id record the time to a file, and when its in focus, i'd record the time to a file. Then I would take the difference when needed to find the total time a window was active. This seems way over complicated and messy.

I figured there was a library, somewhere, or an ingenious way that this could be done. Any example is greatly appreciation.

Just to give an example of what I mean.

A person opens a game...plays for 403 seconds...then switches to another window for 6 seconds then back to the game for 19 seconds, then back to something else for 30 seconds. The timer/variable will have 420 seconds stored to it (403+19).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×