Sign in to follow this  
Followers 0
Cybergon

Relieve eye and body stress

4 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

thank u,i think it will help me :huh2:

Edited by Cposture

Share this post


Link to post
Share on other sites

Whoops, I didn't upload the corrected script, it's ok now :huh2:

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0