"Go to bed!" nagger/reminder

Post your working scripts, libraries and tools
BunsenH
Posts: 31
Joined: 11 Apr 2015, 10:45

"Go to bed!" nagger/reminder

20 May 2017, 11:29

I sometimes have trouble getting off the computer at night, and staying off. I wrote this to be run as a scheduled task in the evening and at night, running more frequently later on. It temporarily pops up a full-screen window in each monitor, on top of all other windows, with a reminder message. It can be set to be "stubborn" -- staying full-screen and resisting attempts to make it go away -- though it can always be shut down via the Task Manager. There are several configurable options set at the top of the script: the text message, the time that the windows should stay up, the text size, the "stubborn" setting, and the window and text colours.

Sleep hygiene at its finest. :-(
The script is hidden in the "spoiler" to minimize clutter.
Last edited by BunsenH on 03 Mar 2019, 22:49, edited 2 times in total.
BunsenH
Posts: 31
Joined: 11 Apr 2015, 10:45

"Go to bed!" nagger/reminder v. 2.0

29 Jan 2019, 20:53

Version 2.0, which accepts command-line parameters to override the script's built-in values. This allows flexibility in how the script behaves without having to edit the script itself.
The script is hidden in the "spoiler" to minimize clutter.
This version also allows use on a multi-user system by checking for the existence of a file named lock.txt in the same directory as the script. If the file is present, the script immediately exits. This file can be created by a trivial batch file create_lock.bat:

Code: Select all

type hi > lock.txt
which is run as a scheduled task when the user logs out, and deleted by another batch file remove_lock.bat:

Code: Select all

if exist lock.txt del lock.txt
which is run as another scheduled task when the user logs in. This feature stops the nagger from disturbing anyone but the specific user.
Last edited by BunsenH on 03 Mar 2019, 23:11, edited 1 time in total.
BunsenH
Posts: 31
Joined: 11 Apr 2015, 10:45

"Go to bed!" nagger/reminder v. 3.0

03 Mar 2019, 23:09

This is version 3.0, with a couple of further enhancements.

Any instances of the string "`n" in the message text will be converted to line breaks. Any instances of the string "$TIME" will be converted to the current time. For example, message text "Go to bed!`n$TIME" would be drawn as something like:
Go to bed!
10:22:05 P.M.

And now, for extra eyecatching-ness, there's a "blink" parameter! When it's used, the colours of the text and the window/background are swapped periodically. You can specify the number of seconds per cycle. The minimum change time is 1 second, and seizure disorders don't usually kick in until flash rates are several times higher than that, but consult your care professional if this kind of thing is of concern to you. It's disabled by default.

The script is hidden inside the "spoiler" to reduce clutter.
BunsenH
Posts: 31
Joined: 11 Apr 2015, 10:45

"Go to bed!" nagger/reminder v. 3.1

04 Mar 2019, 22:59

Version 3.1: "$TIME" in the message text will be converted to show the current time as hours and minutes; "$TIME_S" will display hours, minutes, and seconds. I've found that seeing the display of seconds can be counterproductive, as it makes the text "interesting" and lets me count down to when the nagger will go away.

The script is hidden in the "spoiler" to reduce clutter.
BunsenH
Posts: 31
Joined: 11 Apr 2015, 10:45

Directions for setting up to run on a schedule

07 Mar 2019, 18:15

Here are the directions for setting up the "nagger" up to run as scheduled tasks, with diagrams. I'm doing this in Windows 8.1, but the process should be very similar for any Windows version.
I'm hiding this stuff in a "spoiler" to minimize the apparent clutter.
BunsenH
Posts: 31
Joined: 11 Apr 2015, 10:45

Image of the Task Scheduler window

07 Mar 2019, 18:18

This shows an image of the Task Scheduler window, with some details of a relatively long list of command-line options to control how the script runs.
Inside a spoiler to reduce the footprint of the message for those who aren't interested.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: hasantr, thom_b and 40 guests