Page 1 of 1

"Go to bed!" nagger/reminder

Posted: 20 May 2017, 11:29
by BunsenH
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.

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

Posted: 29 Jan 2019, 20:53
by BunsenH
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.

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

Posted: 03 Mar 2019, 23:09
by BunsenH
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.

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

Posted: 04 Mar 2019, 22:59
by BunsenH
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.

Directions for setting up to run on a schedule

Posted: 07 Mar 2019, 18:15
by BunsenH
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.

Image of the Task Scheduler window

Posted: 07 Mar 2019, 18:18
by BunsenH
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.