Jump to content

Shutdown On Area Change


tom13
 Share

Recommended Posts

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
Link to comment
Share on other sites

  • 4 weeks later...

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

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