Jump to content

Recommended Posts

Posted (edited)

Hey people, just thought I'd share this simple script I've been using and tweaking for a while.

Let it run in the background, it will remind you every 20 minutes via a 3 second message box to look outside and relax your eyes, every 30 minutes to moist them by blinking, and every hour to get up and stretch. If there's a fullscreen application running, it'll make 1,2 or 3 beeping sounds respectively for each cycle. Also the box doesn't show up until after 2 seconds of inactivity, a little something I threw in there to make it a bit less annoying. I use it all the time so since I don't close it I don't need the system tray icon, but if you want you can remove the third line. So without further ado, here it is:

rest.rar

I included the source plus a compile, the WinAPIEx UDF by Yashied, the AnyKey UDF by Maffe811 (genius I tell you), the beep sound files (they sound like those old casio wristwatches, you can change them), and a little stretch sheet taken from the book "Stretching" by Bob Anderson.

It's nothing special really, but I hope it helps!

Enjoy and take care!

#include <Misc.au3>
#include "WinAPIEx.au3"
#include "AnyKey.au3"
Opt ("TrayIconHide",1) ;optional
$dll = DllOpen("user32.dll")
$delay = 0
While 1
    Sleep(20*60000 - $delay)
    $delay = 0
    $size = WinGetPos("[active]")
    If $size[0] = 0 AND $size[1] = 0 AND $size[2] = @DesktopWidth AND $size[3] = @DesktopHeight then
        SoundPlay ("1 Beep.mp3")
    Else
        $val=0
        While (_WinAPI_GetIdleTime()<2000) Or ($val = 1)
            Sleep (100)
            $val = _AnyKey()
            $delay = $delay + 100
        WEnd
        $handle1=WinGetHandle("[active]")
        Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Note'', ''Look Outside and relax your eyes'')"')
        WinActivate("Note","Look Outside and relax your eyes")
        WinSetOnTop("Note","Look Outside and relax your eyes",1)
        $handle2=WinGetHandle("[active]")
        Sleep(3000)
        $delay = $delay + 3000
        $handle3=WinGetHandle("[active]")
        Winclose("Note","Look Outside and relax your eyes")
        If $handle2 = $handle3 Then
            WinActivate($handle1)
        EndIf

    EndIf
    Sleep(10*60000 - $delay)
    $delay = 0
    $size = WinGetPos("[active]")
    If $size[0] = 0 AND $size[1] = 0 AND $size[2] = @DesktopWidth AND $size[3] = @DesktopHeight then
        SoundPlay ("2 Beeps.mp3")
    Else
        $val=0
        While (_WinAPI_GetIdleTime()<2000) Or ($val = 1)
            Sleep (100)
            $val = _AnyKey()
            $delay = $delay + 100
        WEnd
        $handle1=WinGetHandle("[active]")
        Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Note'', ''Blink slowly 10 times to moist your eyes'')"')
        WinActivate("Note","Blink slowly 10 times to moist your eyes")
        WinSetOnTop("Note","Blink slowly 10 times to moist your eyes",1)
        $handle2=WinGetHandle("[active]")
        Sleep(3000)
        $delay = $delay + 3000
        $handle3=WinGetHandle("[active]")
        WinClose("Note","Blink slowly 10 times to moist your eyes")
        If $handle2 = $handle3 Then
            WinActivate($handle1)
        EndIf
    EndIf
    Sleep(10*60000 - $delay)
    $delay = 0
    $size = WinGetPos("[active]")
    If $size[0] = 0 AND $size[1] = 0 AND $size[2] = @DesktopWidth AND $size[3] = @DesktopHeight then
        SoundPlay ("1 Beep.mp3")
    Else
        $val=0
        While (_WinAPI_GetIdleTime()<2000) Or ($val = 1)
            Sleep (100)
            $val = _AnyKey()
            $delay = $delay + 100
        WEnd
        $handle1=WinGetHandle("[active]")
        Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Note'', ''Look Outside and relax your eyes'')"')
        WinActivate("Note","Look Outside and relax your eyes")
        WinSetOnTop("Note","Look Outside and relax your eyes",1)
        $handle2=WinGetHandle("[active]")
        Sleep(3000)
        $delay = $delay + 3000
        $handle3=WinGetHandle("[active]")
        WinClose("Note","Look Outside and relax your eyes")
        If $handle2 = $handle3 Then
            WinActivate($handle1)
        EndIf
    EndIf
    Sleep(20*60000 - $delay)
    $delay = 0
    $size = WinGetPos("[active]")
    If $size[0] = 0 AND $size[1] = 0 AND $size[2] = @DesktopWidth AND $size[3] = @DesktopHeight then
        SoundPlay ("3 Beeps.mp3")
    Else
        $val=0
        While (_WinAPI_GetIdleTime()<2000) Or ($val = 1)
            Sleep (100)
            $val = _AnyKey()
            $delay = $delay + 100
        WEnd
        $handle1=WinGetHandle("[active]")
        Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Note'', ''Stretch, look outside and moist your eyes'')"')
        WinActivate("Note","Stretch, look outside and moist your eyes")
        WinSetOnTop("Note","Stretch, look outside and moist your eyes",1)
        $handle2=WinGetHandle("[active]")
        Sleep(3000)
        $delay = $delay + 3000
        $handle3=WinGetHandle("[active]")
        WinClose("Note","Stretch, look outside and moist your eyes")
        If $handle2 = $handle3 Then
            WinActivate($handle1)
        EndIf
    EndIf
WEnd
Edited by Cybergon
Posted

Nice idea. Someone else had the same idea too.. check out WorkRave.

My contributions:

  Reveal hidden contents

Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFsProcess CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen)Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery

Wrappers/Modifications of others' contributions:

_DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity)

UDF's added support/programming to:

_ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne)

(All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...