Sign in to follow this  
Followers 0
tilgino

shutdown at specifig day to a specific time

8 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by jacob_1998_1999

Share this post


Link to post
Share on other sites

check out the date.au3 udf and such

Share this post


Link to post
Share on other sites

yes... ok

but 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 shutdown

what is this command...

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#6 ·  Posted (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
WEnd

Just 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 by _Kurt

Awaiting Diablo III..

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 hints

thx

Edited by tilgino

Share this post


Link to post
Share on other sites

Always put a Sleep in loops unless speed is very important and CPU-usage ain't.

Share this post


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
Sign in to follow this  
Followers 0