RedneckTech Posted March 1, 2012 Share Posted March 1, 2012 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 comment Share on other sites More sharing options...
somdcomputerguy Posted March 1, 2012 Share Posted March 1, 2012 Try using AutoIt's native Shutdown() function. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
RedneckTech Posted March 1, 2012 Author Share Posted March 1, 2012 oo. thank you. did not know about that one... difference between shutdown and powerdown? (1 & 8 respectively) Link to comment Share on other sites More sharing options...
somdcomputerguy Posted March 1, 2012 Share Posted March 1, 2012 difference between shutdown and powerdown?Try them one at a time and see what happens. I would guess that it's simply two different ways to do the same thing, but I do not know exactly. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
RedneckTech Posted March 1, 2012 Author Share Posted March 1, 2012 thanks man. Link to comment Share on other sites More sharing options...
RedneckTech Posted March 1, 2012 Author Share Posted March 1, 2012 oo. thanks for the heads up. thats important.. thanks will be edited as such Link to comment Share on other sites More sharing options...
somdcomputerguy Posted March 1, 2012 Share Posted March 1, 2012 Yes, 69355, thank you for clarifying that. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now