nicoco Posted March 10, 2006 Share Posted March 10, 2006 Hi, I've done small useless stuff with auto-it before, now I'd like to do something that would help me track my time : how much time I spend reading/writing emails how much time I spend on the web browser how much time I spend ... actually working So my idea is to log in a file when the title of a window when it becomes active, and inactive then I'll be able to make statistics any leads on how to do this? if it's not possible do you know any software that does this? Thanks, Nicoco Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 10, 2006 Moderators Share Posted March 10, 2006 Hi,I've done small useless stuff with auto-it before, now I'd like to do something that would help me track my time :how much time I spend reading/writing emailshow much time I spend on the web browserhow much time I spend ... actually working So my idea is to log in a file when the title of a window when it becomes active, and inactivethen I'll be able to make statistics any leads on how to do this?if it's not possible do you know any software that does this?Thanks,NicocoBe careful to word what you mean specifically here... Do you want 'Active' Windows Logged or When a Visible Window Exists? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
nicoco Posted March 10, 2006 Author Share Posted March 10, 2006 (edited) Be careful to word what you mean specifically here... Do you want 'Active' Windows Logged or When a Visible Window Exists?By active window I mean the window that has the focus. Example : Now I'm replying to this message in firefox, when i'll do alt-tab to switch back to crimson editor, I'd like to have a new line in a log file with the time and 'CrimsonEditor' (and the full title for info on what i'm working on), then when I switch to outlook, another line in the log file, etc.At the end of the day, I'd like to see something likestart;stop;app;full title10-mar-2006@10:15:51;10-mar-2006@10:16:12;Outlook;blah10-mar-2006@10:16:12;10-mar-2006@10:45:08;Firefox;AutoIt Forums10-mar-2006@10:45:08;10-mar-2006@10:55:18;CrimsonEditor;C:\dev\src\Main.java10-mar-2006@10:55:18;10-mar-2006@10:56:58;Firefox;New York Timesetc...Now, what I want to find out is how to detect the change of window focus, the rest is not very difficult Edited March 10, 2006 by nicoco Link to comment Share on other sites More sharing options...
MHz Posted March 10, 2006 Share Posted March 10, 2006 Oh, dunno about this timing stuff. Have a play with this. While 1 $title = WinGetTitle('') MsgBox(0, '', $title) Sleep(1000) WEnd Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 10, 2006 Moderators Share Posted March 10, 2006 (edited) This needs some tweaking:Global $Begin = 1, $ActiveTime = '', $TrapTitle = '', $DeActiveTime = '' HotKeySet('{ESC}', 'EXITTRACK') AdlibEnable('KeepTrackOfWindows', 250) While 1 Sleep(1000) WEnd Func KeepTrackOfWindows() Local $w_WinList = WinList() For $i = 1 to $w_WinList[0][0] If $w_WinList[$i][0] <> "" AND BitAnd(WinGetState($w_WinList[$i][1]), 10) Then $ActiveWindow = $w_WinList[$i][0] ExitLoop EndIf Next If $Begin = 1 Then $TrapTitle = $ActiveWindow $ActiveTime = @MDAY & '-' & @MON & '-' & @YEAR _ & '@' & @HOUR & ':' & @MIN & ':' & @SEC & ';' $Begin = 2 ElseIf $TrapTitle <> $ActiveWindow And $TrapTitle <> '' Then $DeActiveTime = @MDAY & '-' & @MON & '-' & @YEAR _ & '@' & @HOUR & ':' & @MIN & ':' & @SEC & ';' & $TrapTitle FileWrite(@DesktopDir & '\testing.txt', $ActiveTime & $DeActiveTime & @CRLF) $TrapTitle = '' $Begin = 1 EndIf EndFunc Func EXITTRACK() Exit EndFunc Edited March 10, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
nicoco Posted March 12, 2006 Author Share Posted March 12, 2006 brilliant! a thousand thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now