AutoHotkey Community

It is currently May 27th, 2012, 10:43 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Time Away
PostPosted: February 5th, 2008, 10:05 pm 
Offline

Joined: November 1st, 2007, 10:03 pm
Posts: 885
This script will keep track of how much time youve been away from your computer

It show it in seconds and is very accurate
It displays the amount of time away in the GUI


Code:
#persistent
SetBatchLines -1
SetTimer,Append,1000
Gui, Add, Text, x6 y20 w120 h40 vtime, Time Away
Gui, Show, x131 y91 h91 w198, Away Time
return
Append:
If A_TimeIdle > 1000
    {
     Idlesec := A_TimeIdle / 1000
     Transform,Idlesecround,Round, Idlesec
     GuiControl,,time,%Idlesecround% Seconds Away From PC
    }
Else
     GuiControl,,time,%a_timeidle% Milliseconds Away From PC
return

GuiClose:
ExitApp
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2008, 1:28 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
That's not really accurate. Here's another version:

Code:
Gui, -Caption +AlwaysOnTop
Gui, Font, s16 c0x00ffff, Trebuchet MS
Gui, Color, black
Gui, Add, Text, vMsg w350
Gui, Show, x10 y10, Time
Loop {
   t := gft(A_TimeIdlePhysical // 1000)
   GuiControl, , Msg, Time away: %t%
   Sleep, 500
}
Return

~*Esc::ExitApp

gft(s) { ; http://www.autohotkey.com/forum/viewtopic.php?p=93288#93288
   w = day.hour.minute.second
   loop parse, w, .
      s -= (t := s // (x := 60 ** (e := 4 - a_index) - 129600 * (e = 3))) * x
      , t ? m .= t . " " . a_loopfield . chr(115 * (t != 1)) . chr(32 * !!e)
   return m ? m : "0 seconds"
}

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group