Simple Sobriety Tracker

Post your working scripts, libraries and tools
RLocke
Posts: 2
Joined: 17 May 2018, 16:08

Simple Sobriety Tracker

17 May 2018, 16:30

I decided to get my drinking under control before anything got out of hand, and made this Sobriety Tracker. Thought i'd pass it on in case anyone else could use it.
Image

It creates a widget on the desktop that tracks your sobriety (based on the date at the top of the file). It keeps up with days, weeks, months, and years. It also dynamically resizes to fit the content in the widget, can be click and dragged, and can be closed via the notification tray.

New versions can be found on pastebin first, unless there's much interest on this forum: https://pastebin.com/mH9WhZGK

To Do: maybe add some random quotes, in gui-configuration, & maybe track statistics over time if the count ever resets.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

iPhilip
Posts: 287
Joined: 02 Oct 2013, 12:21

Re: Simple Sobriety Tracker

22 May 2018, 17:26

Hi RLocke,

I was inspired by your script so I generalized it and added some functions from the old forum to calculate the elapsed periods:

Code: [Select all] [Expand] [Download] (Tracker.ahk)GeSHi © Codebox Plus

Cheers!
Windows 7 Pro (64 bit) - AutoHotkey v1.1+ (Unicode 32-bit)
kunkel321
Posts: 162
Joined: 30 Nov 2015, 21:19
Facebook: https://www.facebook.com/kunkel321
Google: kunkel321

Re: Simple Sobriety Tracker

23 May 2018, 10:24

Love this!
RLocke
Posts: 2
Joined: 17 May 2018, 16:08

Re: Simple Sobriety Tracker

25 May 2018, 01:31

iPhilip wrote:Hi RLocke,

I was inspired by your script so I generalized it and added some functions from the old forum to calculate the elapsed periods


Awesome thanks, I like your take on it and that can even double as a quick stop watch. I thought I remembered an auto-size option for the GUI, but mathing that out can also be half the fun. lol
User avatar
SpeedMaster
Posts: 204
Joined: 12 Nov 2016, 16:09

Re: Simple Sobriety Tracker

25 May 2018, 03:08

RLocke wrote: It keeps up with days, weeks, months, and years.

Correct me if I am wrong but this script can not sustain a pc reboot. Any idea of an ini file ?
kunkel321
Posts: 162
Joined: 30 Nov 2015, 21:19
Facebook: https://www.facebook.com/kunkel321
Google: kunkel321

Re: Simple Sobriety Tracker

25 May 2018, 07:52

SpeedMaster wrote:Correct me if I am wrong but this script can not sustain a pc reboot. Any idea of an ini file ?

Normally I'd agree with the flexibility of an ini file, but for this particular application (sobriety), I think that having the date "hard coded" might be more appropriate(?)
User avatar
SpeedMaster
Posts: 204
Joined: 12 Nov 2016, 16:09

Re: Simple Sobriety Tracker

25 May 2018, 17:14

start_date := A_Now :arrow: Ok, this assertion will not support a restart of the PC. :facepalm:
I tested both scripts with USA Independence Day start_date := 17760704 (July 4, 1776).
iPhilip's script gives a more accurate result but does not give the total number of days. :think:

http://www.mycalculators.net/utility/day-counter
iPhilip
Posts: 287
Joined: 02 Oct 2013, 12:21

Re: Simple Sobriety Tracker

25 May 2018, 18:48

Hi SpeedMaster,

With respect to the use of an ini file, you can definitely do that if you want to. As kunkel321 pointed out, because that date won't change that often (hopefully! ;) ), it's perhaps more work than necessary. The script file can act as the source of the data.

Thank you for testing it with such a fun date (July 4, 1776) :dance:. The reason why my script doesn't show the total number of days is because I only allocated 3 digits for that field in this line in the script (which represents the widest field in the Gui):

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

Gui, Add, Text, cwhite vDays, Total seconds:`t000
If you add two more zeros at the end of the line,

Code: [Select all] [Download] (Untitled.ahk)GeSHi © Codebox Plus

Gui, Add, Text, cwhite vDays, Total seconds:`t00000
the number of days will display properly (88348). I wasn't anticipating starting the count that far back. :lol:

Cheers!
Windows 7 Pro (64 bit) - AutoHotkey v1.1+ (Unicode 32-bit)

Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 15 guests