tilgino Posted November 16, 2006 Posted November 16, 2006 hi, is it possible to shutdown the computer to a specific time of day? the computer is turned on manually by an employee each morning and should shutdown automaticly at following times: monday at 9 PM thuesday at 7 PM wednesday at 9 PM thursday at 5 PM friday at 1 PM saturday at 1 PM sunday turned off how can this be done? thx for hints peter
jacob_1998_1999 Posted November 16, 2006 Posted November 16, 2006 (edited) You could write: Shutdown(9) Compile it to an exe and then use Scheduled Tasks from MicroSoft. Quick simple solution. Edit: Added the Code, in code layout. -- It would only take 4 scheduled tasks to complete your objective. Edited November 16, 2006 by jacob_1998_1999
tilgino Posted November 18, 2006 Author Posted November 18, 2006 yes... okbut i need an command which is constantly watching how late is it...it should constantly watch out for something like this:if time = x do shutdownwhat is this command...
Thatsgreat2345 Posted November 18, 2006 Posted November 18, 2006 While...Wend loop combined with an If...Then Statement using the Date.au3 UDF. Maybe if you tried coding something on yourself you might get what you want instead of waiting for someone to do it for you.
_Kurt Posted November 18, 2006 Posted November 18, 2006 (edited) Okay well since no one has any ideas, I was thinking it would be something like this:inc. <Date.au3> ;Run on startup RegWrite('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'ResoChanger', 'REG_SZ', '"' & @ScriptFullPath & '"') While 1 $checktime = _nowcalc() ;check the time $trimtime = ;stringtrim the time so it displays as XX:XX If $trimtime = XX:XX Then Shutdown() EndIf WEndJust an idea. If you have alot of trouble making one, just tell me and I'll try and actually make one Kurt*EDIT* Also, you check which day it is by $checkday = StringInStr($checktime, "Sun");For sunday If $checkday = 0 Then (..) etc Edited November 18, 2006 by _Kurt Awaiting Diablo III..
tilgino Posted November 18, 2006 Author Posted November 18, 2006 (edited) many thx kurt...it works so far...the problem now is that my computer CPU needs 100% to do the "while" task... this is bad because other tools should be running in the background... maybe its too hard for my computer to ask for time each 10 millisecond :-(is it possible to check the time each 30 seconds only once and if the time is 18:00 (hh/mm) then shutdown... the seconds doesn't matter just ask for hh and mm...another question... what does this line means in your code???RegWrite('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'ResoChanger', 'REG_SZ', '"' & @ScriptFullPath & '"')any hintsthx Edited November 18, 2006 by tilgino
Helge Posted November 18, 2006 Posted November 18, 2006 Always put a Sleep in loops unless speed is very important and CPU-usage ain't.
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