Sign in to follow this  
Followers 0
tom13

Shutdown On Area Change

2 posts in this topic

Very easy script, made this so I can sleep tonight without letting the computer run for nothing. I'm currently installing a 25GB large program and I know that the "cancel" button will change into "exit" when it finishes, thus I let this script check for that change and once it has been spotted it will shut down the system.

#Include <Misc.au3>
#Include <Timers.au3>

MsgBox(0, "", "Please move your mouse to the LEFT TOP corner of the pixelchecksum box and then press CTRL.")
Do
    Sleep(1)
Until _IsPressed("11")
$lt = MouseGetPos()

MsgBox(0, "", "Please move your mouse to the RIGHT BOTTOM corner of the pixelchecksum box and then press CTRL.")
Do
    Sleep(1)
Until _IsPressed("11")
$rb = MouseGetPos()

$secs = InputBox("", "Every howmany seconds should we check for a difference in the area?", "10")

MsgBox(0, "", "Information known, please press CTRL to start, if the area changes the system will shut down.")

Do
    Sleep(1)
Until _IsPressed("11")
SoundPlay(@WindowsDir & "\media\tada.wav",1)

$check = PixelCheckSum($lt[0], $lt[1], $rb[0], $rb[1])

Do
    Sleep($secs * 1000)
Until $check <> PixelCheckSum($lt[0], $lt[1], $rb[0], $rb[1])
TrayTip("Shutting down!", "Difference spotted, shutting down. Press CTRL within 10 seconds to abort!", 10)

$ctrl = False
$time = _Timer_Init()
Do
    Sleep(1)
    If _IsPressed("11") Then
        $ctrl = True
    EndIf
Until $ctrl = True OR _Timer_Diff($time) > 10000

If $ctrl = True Then
    MsgBox(0, "", "You did not want to shut down afterall, quitting program.")
    Exit
Else
    Shutdown (9)
EndIf

Share this post


Link to post
Share on other sites



Great Program. I was trying something similar in which when the window exited, it would shutdown or do some other option, which didnt work for some things like system scans. You could further it by giving opitons to run programs or do some other commands.

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