AutoHotkey Community

It is currently May 27th, 2012, 1:19 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Timer
PostPosted: August 7th, 2008, 10:35 pm 
This timer sets up a periodic (default 10 minutes) reminder to give you a reality check of how long you've been working on something. I leave it on running almost all the time now.

P.S. I'm always looking for these little conceptually interesting (rather than... "efficient" or "elegant" or ever "practical") scripts, if anyone has any.

Code:
#SingleInstance, force
#Persistent
#NoEnv

Period = 10 ;The time, in minutes, of the period
SplashTextOn,200,25,,Timer Started
Sleep, 2000
SplashTextOff
Time_Elapsed = 0
SleepTime := Period*60000
SetTimer, DisplayTime, %SleepTime%
Return

DisplayTime:
   Time_Elapsed += Period
   Hours := Time_Elapsed // 60
   Minutes := Mod(Time_Elapsed, 60)
   If Hours
      Display := Hours . " hour" . (Hours = 1 ? "" : "s") . " " . Minutes " minute" . (Minutes = 1 ? "" : "s")
   else
      Display := Minutes .  " minute" . (Minutes = 1 ? "" : "s")
   SplashTextOn,200,25,,%Display%
   Sleep, 3000
   SplashTextOff
   Return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 25th, 2008, 11:49 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
This reminds me of the first GUI script I wrote which was a simple timer like this one :P

_________________
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: Bing [Bot], Bon 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