Jump to content

Auto shutdown


Recommended Posts

Is there a script that will check if the mouse has not been clicked for a while and the keyboard was not pressed. If mouse is not clicked and the keyboard has not been pressed for 1 hour then force shutdown pc.

Im very annoyed because my brother always leaves the pc open when he sleeps and our electric bills has skyrocketed because of that.

I've search for scripts that will execute some task after the timer has done its loop

Global Const $Minutes = 30
Global $60Count = 0, $begin = TimerInit()

While  $Minutes > $60Count
;check if mouse and keyboard are idle
sleep(1)
$dif = TimerDiff($begin)
$Count = int($dif/1000)
$60Count = Int($Count / 60)
WEnd        

call("_forceshutdown") 

Func _forceshutdown()
    Shutdown(5)  ;Force a shutdown
    MsgBox(0, "Automatic program", "!! Shutting down !!",15)
EndFunc
Edited by adik2dmax666
First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack. -George Carrette[sub]GD Keylogger Creator (never released)[/sub][sub]Garena Autojoin v3.0[/sub]
Link to comment
Share on other sites

Is there a script that will check if the mouse has not been clicked for a while and the keyboard was not pressed. If mouse is not clicked and the keyboard has not been pressed for 1 hour then force shutdown pc.

Im very annoyed because my brother always leaves the pc open when he sleeps and our electric bills has skyrocketed because of that.

I've search for scripts that will execute some task after the timer has done its loop

Controlling automatic PC shutdown via script that polls for user input is very inefficient and unreliable. All Windows versions from Win95 on provide built-in mechanisms to achieve what you need: go to Control Panel -> Energy Options and configure there the timeouts to trigger stand-by or hibernate (soft-off). Further options (log-off, shutdown) offers a screensaver Winexit freely available from Microsoft. Edited by doudou

UDFS & Apps:

Spoiler

DDEML.au3 - DDE Client + Server
Localization.au3 - localize your scripts
TLI.au3 - type information on COM objects (TLBINF emulation)
TLBAutoEnum.au3 - auto-import of COM constants (enums)
AU3Automation - export AU3 scripts via COM interfaces
TypeLibInspector - OleView was yesterday

Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ 

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...