E.g.:
Code: Select all
!o::TrayTip,Time Online, % Convert.TickCount.toDisplay(A_TickCount)
^o::
Loop
{
KeyWait, o
ToolTip, % Convert.TickCount.toDisplay(),0,0
Sleep, 1000
If (GetKeyState("Ctrl","P")=1)
{
ToolTip
Break
}
}
Return
- toDisplay is great for Tooltips, Msgboxs, and TrayTips, 3 lines long: Return "Hours" A_Tab "Minutes" A_Tab "Seconds`n" h A_Tab m A_Tab s "`nSince Windows Boot."
- toFile is used for single line displays in the format 'H:M:S'
- The Convert part of the class is there because I have plans to make a whole conversion class with other things. I imagine it can be stripped and used as TickCount.toHours() etc....
- toSeconds() gives mod()ed remainder for toDisplay() and Seconds() gives the actual seconds and so on and so forth for Days, Hours, and Minutes.
Convert Tick Count Class:
Code: Select all
Class Convert {
Class TickCount {
toDays(count:=False){
Return Floor(Mod((((((count:=count?count:A_TickCount)/1000)/60)/60)/24),24))
}
Days(count:=False){
Return Floor(((((count:=count?count:A_TickCount)/1000)/60)/60)/24)
}
toHours(count:=False){
Return Floor(Mod(Mod(((((count:=count?count:A_TickCount)/1000)/60)/60),60),24))
}
Hours(count:=False){
Return Floor(((((count:=count?count:A_TickCount)/1000)/60)/60))
}
toMinutes(count:=False){
Return Floor(Mod((((count:=count?count:A_TickCount)/1000)/60),60))
}
Minutes(count:=False){
Return Floor((((count:=count?count:A_TickCount)/1000)/60))
}
toSeconds(count:=False){
Return Floor(Mod(((count:=count?count:A_TickCount)/1000),60))
}
Seconds(count:=False){
Return Floor(((count:=count?count:A_TickCount)/1000))
}
toDisplay(count:=False){
count:=count?count:A_TickCount
d:=Convert.TickCount.toDays(count)
h:=Convert.TickCount.toHours(count)
m:=Convert.TickCount.toMinutes(count)
s:=Convert.TickCount.toSeconds(count)
Return "Days" A_Tab "Hours" A_Tab "Minutes" A_Tab "Seconds`n"
. d A_Tab h A_Tab m A_Tab s "`nSince Windows Boot."
}
toFile(count:=False){
count:=count?count:A_TickCount
d:=Convert.TickCount.toDays(count)
h:=Convert.TickCount.toHours(count)
m:=Convert.TickCount.toMinutes(count)
s:=Convert.TickCount.toSeconds(count)
Return d ":" h ":" m ":" s
}
}
}