Advertisement
Guest User

traytip

a guest
Dec 3rd, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. enddate := 201901311630 ;specify end date code updated for AHKv2
  2.  
  3. secondsleft := enddate ;sets seconds left to the end date measures in unix time
  4. secondsleft -= a_now, seconds ; deducts the current time measured in unix time from the end time
  5.  
  6. TimeLeft := (secondsleft * 1000) ;as unix time is in units of seconds - multiply it all by 1000 to get the seconds left with milliseconds
  7. End_Time := A_TickCount + TimeLeft ;sets end time + current number of milliseconds since boot, as when you ran the script as a baseline. this is your zero point latter subtractions will "deduct" a larger number, thusly your counter will go down by "1 second" see sleep 1000
  8. Time_Remaining := true ;initiates the variable
  9. while (Time_Remaining > 0)
  10. {
  11.     Time_Remaining := ( End_Time - A_TickCount )/1000 ;this recalculates numbers of seconds left in roughly one second increments enabling an updated remainder of time to be displayed below is just some math to convert into days hours etc
  12.     Days := floor(Time_Remaining/86400)
  13.     Time_Remaining -= Days * 86400
  14.     Hours := floor(Time_Remaining/3600)
  15.     Time_Remaining -= Hours * 3600
  16.     Minutes := floor(Time_Remaining/60)
  17.     Time_Remaining -= Minutes * 60
  18.     Seconds := floor(Time_Remaining)
  19.     disp_time := "Freedom in: " Days " days - " Hours " hours - " Minutes " minutes - " Seconds " seconds." ;literally just does what it say on the tin, saves current amount of time left in a readable format
  20.  
  21.     TrayTip disp_time ;prints a popup balloon by the systray after the sleep 1000 it's destroyed and replaced with a new balloon giving the illusion of an auto-updating popup
  22.     Sleep 1000 ;waits for a second before starting loop again
  23. }
  24.  
  25. ^+z::Exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement