AutoIT- Simple Timer

A simple Autoit code..

[autoit]

#comments-start
# author : ram
# site      : ramnathbabu.com
# Displays a timer at the TOP LEFT (can be customized)
#         corner of your screen. Displays the time you have spent
# You are free to modify/use/distribute the code.
# Try to retain the site somewhere in the script
#comments-end

; setting HotKey
HotKeySet(“{ESC}” , “fexit”)

;Tray GUI Creation
$aboutitem  = TrayCreateItem(“About”)
TrayCreateItem(“”)
$exit = TrayCreateItem(“Exit”)
TraySetState()

;Timer
$begin = TimerInit()

While 1
; gives seconds
$T = StringLeft( TimerDiff($begin), _
StringInStr(TimerDiff($begin), “.”) -4)

Sleep(20)

; check if the tray has been clicked
$msg = TrayGetMsg()

; tooltip diplay @ top-left corner
ToolTip(“” & Int($T / 60) & “:” & mod($T,60), 0, 0, “Timer”)

Select
Case $msg = $aboutitem
; if the user has clicked “About”
Msgbox(64,”About:”,”November 2010″ & @crlf & @crlf & _
“Instructions:” & @CRLF & “ALT+CTRL+SHIFT+X – Get Progress” _
& @CRLF & “ALT+ESC – Exit Program” & @crlf & @crlf & “Free usage :)”)

Case $msg = $exit
; if the user has clicked “Exit”
Exit
EndSelect
WEnd

func fexit()
; when “Esc” button is pressed – exit
Exit
EndFunc

[/autoit]

Leave a comment

Your email address will not be published. Required fields are marked *