Jump to content

Recommended Posts

so my sisters leave the computer on all the time and ive had a request to make a script. after time=x. heres what ive got:

#include <Timers.au3>
#include <Date.au3>

$Timeout = $desiredtime
$File = "C:\ShutdownLog\Log.txt"
$Directory = "C:\ShutdownLog"
$uFile = @UserProfileDir & "\SDLog.txt"
$FileHandle = FileOpen($File, 1)
$uFileHandle = FileOpen($uFile, 1)
If FileExists($File) = 0 Then
   DirCreate($Directory)
EndIf
While 1
   $TimeIdle = _Timer_GetIdleTime()
   If $TimeIdle >= $Timeout Then
   FileWriteLine ($FileHandle, "Shutdown at: " & _NowCalc() & " Logged on user was: " & @UserName)
   FileWriteLine ($uFileHandle, "Shutdown at: " & _NowCalc() & " while you were logged on")
   Run (@ComSpec & " /c " & "Shutdown.exe -s -t 01", "", @SW_HIDE)
   EndIf
WEnd

main problem is the line:

Run (@ComSpec & " /c " & "Shutdown.exe -s -t 01", "", @SW_HIDE)

when it runs the computer just sits, and sits, and sits at the shutdown window to the point of holding the power button after 20 min. and before that i get popups saying that the process has failed to start. Test System = Win7 Pro and final system = Winxp home.

any ideas whats wrong with this?

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...