Applies to:

  • Microsoft Windows 7 Enterprise
  • AutoHotkey (see code for AHK version)

What?
Someone suggested an app that counts the days I have left serving my notice. I thought I'd go one better and have it calculate to the nearest second. I call this latest app "byeBU" and this is version 0.4 Beta (unofficial app).

Why?
Something to do...

How?
The following code is using AutoHotkey (AutoIt) and is the source code as compiling it wouldn't be much use to anyone else unless they work for the same company and they're leaving on the same date at the same time. Amend the "FinalDate" value to when you leave, compile the code into an executable, and schedule it as a windows task for when you are logged in:
;
; AutoHotkey Version: 1.0.47.06
; Language:     English
; Platform:     Win9x/XP
; Author:       Joel Lipman <jlipman@bournemouth.ac.uk>
; Date Created: 15-July-2014
;
; Script Function:
;       Just a countdown for my last days at BU.
;
; **********************************************************************************************************************************************************************
; DEFAULT INITIALIZATION
; **********************************************************************************************************************************************************************

        #NoEnv                          ; Recommended for performance and compatibility with future AutoHotkey releases.
        #SingleInstance Force           ; Skips the prompt that a current instance is running and overwrites this one with a fresh instance of this program
        SendMode Input                  ; Recommended for new scripts due to its superior speed and reliability.
        SetWorkingDir %A_ScriptDir%     ; Ensures a consistent starting directory.
        SetFormat, float, 0.2           ; Round any floats to two decimals

; **********************************************************************************************************************************************************************
; DECLARE GLOBALS
; **********************************************************************************************************************************************************************

        ; Program title
        ThisProgram:="ByeBU Countdown"

        ; Program version
        ThisVersion:="0.3 Beta"

        ; My leaving date
        FinalDate := "2014" "08" "29" "13" "00" "00"

        ; Background image to change to during the running of this program
        DesktopBackgroundImage1:="\\bournemouth.ac.uk\data\Staff\Home\jlipman\My Pictures\byeBU\byeBU_byPChristopher.bmp"

        ; Background image to revert to once program ends
        DesktopBackgroundImage2:="\\bournemouth.ac.uk\data\Staff\Home\jlipman\My Pictures\Win7_ScrSvr\BU_Core_CMYKportraitbigwithborder.jpg"

        ; Default Message reference
        ThisMessageIndex:=0

; **********************************************************************************************************************************************************************
; SETUP TRAY ICON
; **********************************************************************************************************************************************************************

        Menu, Tray, Tip, %ThisProgram% v%ThisVersion%
        GoSub, TrayMenu

; **********************************************************************************************************************************************************************
; RUN PROGRAM
; **********************************************************************************************************************************************************************

        ; set up array of jokes
        Joke1:="I pretend to work here, work pretends to pay me."
        Joke2:="He sets low personal standards and then consistently fails to achieve them."
        Joke3:="If he were any more stupid, he'd have to be watered twice a week."
        Joke4:="He has two brain cells, one is lost the other is out looking for it."
        Joke5:="If you gave him a penny for his thoughts, you would get change."
        Joke6:="The gates are down, the lights are flashing, but the train ain't coming."
        Joke7:="This employee is depriving a village somewhere of an idiot."
        Joke8:="The wheel is turning but the hamster is dead."
        Joke9:="When his IQ reaches 50, he should sell, sell, sell."
        Joke10:="Not so much of a has-been, more of a definite won't be."
        Joke11:="If you see two people talking and one looks bored, he's the other one."

        ; make program select one joke in this instance
        Random, JokeIndex, 1, 11
        ThisJoke:=Joke%JokeIndex%

        ; set the background image
        DllCall("SystemParametersInfo", UInt, 0x14, UInt, 0, Str, DesktopBackgroundImage1, UInt, 1)

        ; Run tooltip messages
        SetTimer, UpdateMessage, 10000
        GoSub, UpdateMessage

; **********************************************************************************************************************************************************************
; STOP CREATING THE GUI
; **********************************************************************************************************************************************************************

        RETURN

; **********************************************************************************************************************************************************************
; MAIN FUNCTIONS
; **********************************************************************************************************************************************************************

        UpdateMessage:

                ; TOTALS
                ThisManySeconds:=DateDiff( A_Now, FinalDate, "s" )
                ThisManyMinutes:=Floor(ThisManySeconds/60)
                ThisManyHours:=Floor(ThisManySeconds/3600)
                ThisManyDays:=Floor(ThisManySeconds/86400)
                ThisManyWeeks:=Floor(ThisManySeconds/604800)
                ThisManyMinutesRemainder:=Mod(ThisManySeconds, 60)
                ThisManyHoursRemainder:=Mod(ThisManyMinutes, 60)
                ThisManyDaysRemainder:=Mod(ThisManyHours, 24)
                ThisManyWeeksRemainder:=Mod(ThisManyDays, 7)
                ThisManyWeeksMessage:=ThisManyWeeks " week" ( ThisManyWeeks==1?"":"s") " and " ThisManyWeeksRemainder " day" ( ThisManyWeeksRemainder==1?"":"s")
                ThisManyDaysMessage:=ThisManyDays " day" ( ThisManyDays==1?"":"s") " and " ThisManyDaysRemainder " hour" ( ThisManyDaysRemainder==1?"":"s")
                ThisManyHoursMessage:=ThisManyHours " hour" ( ThisManyHours==1?"":"s") " and " ThisManyHoursRemainder " minute" ( ThisManyHoursRemainder==1?"":"s")
                ThisManyMinutesMessage:=ThisManyMinutes " minute" ( ThisManyMinutes==1 ?"":"s") " and " ThisManyMinutesRemainder " second" ( ThisManyMinutesRemainder==1?"":"s")

                ; WORKING TOTALS ; minus weekends, sleep and time not at work
                ThisManyWorkingSeconds:=DateDiff( A_Now, FinalDate, "s" ) - ((ThisManyDays - (ThisManyWeeks*2)) * 59760)
                ThisManyWorkingMinutes:=Floor(ThisManyWorkingSeconds/60)
                ThisManyWorkingHours:=Floor(ThisManyWorkingSeconds/3600)
                ThisManyWorkingDays:=Floor(ThisManyWorkingSeconds/86400)
                ThisManyWorkingDaysIn:=ThisManyDays - (ThisManyWeeks*2) ; days you have to be in NOT a seconds to days conversion
                ThisManyWorkingWeeks:=Floor(ThisManyWorkingSeconds/604800)
                ThisManyWorkingMinutesRemainder:=Mod(ThisManyWorkingSeconds, 60)
                ThisManyWorkingHoursRemainder:=Mod(ThisManyWorkingMinutes, 60)
                ThisManyWorkingDaysRemainder:=Mod(ThisManyWorkingHours, 24)
                ThisManyWorkingWeeksRemainder:=Mod(ThisManyWorkingDays, 7)
                ThisManyWorkingWeeksMessage:=ThisManyWorkingWeeks " week" ( ThisManyWorkingWeeks==1?"":"s") " and " ThisManyWorkingWeeksRemainder " day" ( ThisManyWorkingWeeksRemainder==1?"":"s")
                ThisManyWorkingDaysMessage:=ThisManyWorkingDays " day" ( ThisManyWorkingDays==1?"":"s") " and " ThisManyWorkingDaysRemainder " hour" ( ThisManyWorkingDaysRemainder==1?"":"s")
                ThisManyWorkingDaysInMessage:=ThisManyWorkingDaysIn " day" ( ThisManyWorkingDays==1?"":"s") " you actually have to be in."
                ThisManyWorkingHoursMessage:=ThisManyWorkingHours " hour" ( ThisManyWorkingHours==1?"":"s") " and " ThisManyWorkingHoursRemainder " minute" ( ThisManyWorkingHoursRemainder==1?"":"s")
                ThisManyWorkingMinutesMessage:=ThisManyWorkingMinutes " minute" ( ThisManyWorkingMinutes==1 ?"":"s") " and " ThisManyWorkingMinutesRemainder " second" ( ThisManyWorkingMinutesRemainder==1?"":"s")

                ; MESSAGES
                Message0:="All's well at " A_Hour ":" A_Min " on " A_DDDD ", " A_DD " " A_MMMM " " A_YYYY "`n`nAnd it's time for that gentle reminder..."
                Message1:="In total...`nYou have " ThisManyWeeksMessage " left at BU.`n`nIn more detail:`n • " ThisManyDaysMessage "`n • " ThisManyHoursMessage "`n • " ThisManyMinutesMessage
                Message2:="You have " ThisManyWorkingDaysInMessage "`n`nIn terms of working time:`n • " ThisManyWorkingWeeksMessage "`n • " ThisManyWorkingDaysMessage "`n • " ThisManyWorkingHoursMessage "`n • " ThisManyWorkingMinutesMessage
                Message3:="Comments from the employee performance evaluation:"

                If ThisMessageIndex = 0
                        TrayTip, ByeBU, %Message0%,10,1

                If ThisMessageIndex = 1
                        TrayTip, ByeBU, %Message1%,10,1

                If ThisMessageIndex = 2
                        TrayTip, ByeBU, %Message2%,10,1

                If ThisMessageIndex = 3
                {
                        TrayTip, ByeBU, %Message3%`n`n`"%ThisJoke%`",10,1
                        SetTimer, UpdateMessage, Off
                        Sleep, 12000
                        GoSub, GoExit
                }

                ThisMessageIndex++

        Return

        DateDiff( startdate, enddate, units="d" ) {
                If units NOT IN s,sec,second,seconds,m,min,minute,minutes,h,hour,hours,d,day,days
                        units := "d" ; default to days
                Else StringLeft, units, units, 1
                enddate -= startdate, %units%
                return enddate
        }

; **********************************************************************************************************************************************************************
; TRAY FUNCTIONS
; **********************************************************************************************************************************************************************

        TrayMenu:
                Menu, Tray, NoStandard                  ; Disable standard menu items
                Menu, Tray, Add, Restart, Restart       ; Restart/Reload Script
                Menu, Tray, Add, Exit, GuiClose         ; Terminate script
        Return

; **********************************************************************************************************************************************************************
; END PROGRAM
; **********************************************************************************************************************************************************************

        Restart:
                Reload

        GoExit:
        GuiClose:
                DllCall("SystemParametersInfo", UInt, 0x14, UInt, 0, Str, DesktopBackgroundImage2, UInt, 1)
                Gui, Destroy
        ExitApp

Screenshots:
On the basis that my final working date for this is 29-August-2014 @ 13:00.








Add comment


Send

Comments   

+1 tomoe_uehara Friday, 26th September 2014, 7:52 pm
A funny way to use AHK :lol:
But actually I've made something like this too, to remind me the last day of working on my old workplace..