Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I work for 12 hour shifts and I would like to make myself a screen saver that would show

"Going home in $time"

where $time is the current shift finish - current time.

Is something like this possible ?

share|improve this question
If you're working on the machine, why would a screen saver be coming up at all? Or do you mean wallpaper? – Shinrai Mar 20 '12 at 22:52
@Shinrai I meant screensaver - When I am leaving the desk the text would appear. – Patryk Mar 21 '12 at 3:26
I just thought the request odd because if you're not at the desk, it might be difficult to see the text at all. That's why I wanted to clarify. Thanks. – Shinrai Mar 21 '12 at 3:47
up vote 1 down vote accepted

This VBScript will automatically update the 3D Text screensaver text with the time left before your shift ends. Save the following text in a file called UpdateScreensaver.vbs and modify the line with FINISH_TIME to have the correct end time:

Option Explicit
' Simple vbscript to update the 3D Text screensaver with
' the number of hours left before a shift finishes.
' FINISH_TIME is the 24-hour time when you finish. 
Const FINISH_TIME = "21:15:00"
' REGISTRY_KEY is the key to update with the time. This will be
' different if you aren't using the 3D text screensaver.
Const REGISTRY_KEY = "HKCU\Software\Microsoft\Windows\CurrentVersion\Screensavers\ssText3d\DisplayString"
' You don't need to change anything below here!
' ==============================================================
Dim iHours, iMins, sMessage, sUnit
iMins = DateDiff("n", Now(), FormatDateTime(Now(), 2) & " " & FINISH_TIME)
If iMins < 0 Then
    ' Assuming shift work - so the finish time is tomorrow, not today.
    iMins = DateDiff("n", Now(), FormatDateTime(DateAdd("d", 1, Now()), 2) & " " & FINISH_TIME)
End If
iHours = Int(iMins / 60) : iMins = iMins Mod 60
If iHours > 20 Then
    sMessage = "Shift over!"
    If iHours > 0 Then
        sMessage = iHours
        If iMins > 45 Then
            sMessage = sMessage & Chr(190) & " hours"
        ElseIf iMins > 30 Then
            sMessage = sMessage & Chr(189) & " hours"
        ElseIf iMins > 15 Then
            sMessage = sMessage & Chr(188) & " hours"
        ElseIf iHours > 1 Then
            sMessage = sMessage & " hours"
            sMessage = sMessage & " hour"
        End If
        sMessage = sMessage & iMins & " minute"
        If iMins <> 1 Then sMessage = sMessage & "s"
    End If
    sMessage = sMessage & " to go!"
End If
Dim wsh : Set wsh = CreateObject("WScript.Shell")
wsh.RegWrite REGISTRY_KEY, sMessage
Set wsh = Nothing

Now double click on the file to run it and nothing should happen. This is good. Now go and check the settings for the 3D Text screensaver and you should see that it displays the hours left before your shift ends.

All you need to do now is set up a scheduled task to run this every 15 minutes (or so) and your screensaver will be kept up to date with the number of hours left.

Some notes:

  1. It looks like that if the time gets updated whilst the screensaver is running then the screensaver doesn't update until the next time it is run. I can't do anything about that.
  2. There is a 20 character limit with this screensaver, hence the shorter text.
  3. If you want to use another screensaver, then you need to find out where it stores the string containing the message in the registry and change the line with REGISTRY_KEY to match that location.
  4. Because it assumes shift work, as soon as your shift finishes the number of hours left will flip back to 24 and count down again. To compensate for this, I've added a hack so that if the hours left is greater than 20, it'll state "Shift over!".


share|improve this answer
This is awesome :) Thanks a lot. Although, I would like it to have it updating in real time it's still ok. Maybe I will try to implement it somehow later on. – Patryk Jul 4 '12 at 8:00

Windows Screensaver's are basically just executables with the .scr extension, write an program in C or C++ for that, pretty simple enough.

share|improve this answer

I found that instead of using Visual Studio there are other ways like scripting in AutoIT.

Go to the the Downloads section on the website. It doesn't require membership either. Go to the download for the AutoIT application coder and compiler etc. Then search on the downloads page I think its like the misc. section and like the 3rd page in there is a thread called "ScreenSaver Demo - Matrix Included" that contains the source code as well as an example for you to build.

So you open the compiler, insert the script (even create your own icon), click Compile (ensure the script is not in the same directory as the place where you want to place the .exe).

Compile it and it will create an .exe file of your mane choice i.e. Matrix. Then you rename to .scr extension and drop it in the system32 folder and it will show up in the options when you go to personalise -> screensavers. The first time I ran it it didn't like it and would not let me click options, how ever after rebooting it works flawlessly.

For information on how it was compiled check the thread in the forums of AutoIT called Screensaver UDF.

share|improve this answer
The reason links are often frowned upon is because they go stale - in this case linking to the website in question won't be frowned upon, since it does look like in this case, it would likely be alright. – Journeyman Geek May 28 '12 at 3:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .