How to reboot PC based on time of day?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
jwimer

How to reboot PC based on time of day?

Post by jwimer » Tue May 11, 2004 5:52 pm

What's wrong with the script I've created below? At 1:50 PM it will not go to the Reboot label ...


Wait>5

Label>Start

GetTime>

Hour>Hour
Min>Minutes

If>Hour=1 and If>Minutes=50,Reboot

Goto>Start

Label>Reboot
ShutDownWindows>1

jwimer
Newbie
Posts: 1
Joined: Tue May 11, 2004 6:07 pm

Re: How to reboot PC based on time of day?

Post by jwimer » Tue May 11, 2004 6:12 pm

[quote="jwimer"]What's wrong with the script I've created below? At 1:50 PM it will not go to the Reboot label ...


Wait>5

Label>Start

Hour>Hour
Min>Minutes

If>Hour=1 and If>Minutes=50,Reboot

Goto>Start

Label>Reboot
ShutDownWindows>1
[/quote]

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue May 11, 2004 7:15 pm

This is your original script that does not work:
Wait>5
Label>Start
Hour>Hour
Min>Minutes
If>Hour=1 and If>Minutes=50,Reboot
Goto>Start
Label>Reboot
ShutDownWindows>1
You cannot combine IF> on same line. Need to do something like this:
Label>Start
Wait>5
Hour>Hour
Min>Minutes
If>%Hour%13,Start
If>%Minutes%=50,Reboot,Start

Label>Reboot
ShutDownWindows>1


This will loop continuously, and check for 13:50 every 5 seconds.
Need to move Wait>5 inside Start in order to loop contnuously.
Time format is based on your system settings. My system hours are based on 24 hour clock, so need to check for 13 to get 1PM.

Another thought....it might be easier to just make a single line macro like this:
ShutDownWindows>1
and have it scheduled to run at 1:50 PM.

Be sure to remove any Trailing Space Characters from each line.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Tue May 11, 2004 10:52 pm

And (as often) the command line is your friend: run this at Start\Run: CMD /K AT /? to get detailed information how you can run a scheduled program, script, batch, ...

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue May 11, 2004 11:18 pm

I don't think that "AT" is available on Operating Systems that are not in the NT family(NT, 2K, XP). So that ( CMD /K AT /?) will not be available to users of WIN9x systems.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

John Wimer

Post by John Wimer » Wed May 12, 2004 12:21 pm

Thanks for all replies.

Bob, I'll use the revised script that you suggested.

I actually am going to set up the script to cause a reboot every six hours. Your example has shown me how to do it.

I'm managing a remote PC that is in the lobby of a building that runs a PowerPoint slide show 24/7 and I'm setting up a periodic reboot to refresh its network connection, etc.

One more question please: Where do I go in Windows 2000 to change the system clock from 12 to 24 hour format?

John Wimer

Post by John Wimer » Wed May 12, 2004 12:27 pm

Sorry, never mind question about system clock. Just found answer in Control Panel > Regional Settings.

Thanks again for helpful replies!!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts