AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how do I make it Shut down computer at 12 pm

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
habs42
Guest





PostPosted: Wed Jul 02, 2008 9:14 pm    Post subject: how do I make it Shut down computer at 12 pm Reply with quote

my script is :

Code:
Loop
{
FormatTime, TimeString
MsgBox The current time and date (time first) is %TimeString%

FormatTime, TimeString, T12, Time
MsgBox The current 24-hour time is %TimeString%

If TimeString =
MsgBox The computer will reboot now

Else
MsgBox The computer will stay on
}


What do I put after TimeString= I tried everything
thanks in advance for your help
Back to top
BoBo²
Guest





PostPosted: Wed Jul 02, 2008 9:43 pm    Post subject: Reply with quote

SetFormat, Check, 60*1000*60
If/Else
A_Hour
Return
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 6084

PostPosted: Wed Jul 02, 2008 10:22 pm    Post subject: Reply with quote

Code:
Loop
 If ( SubStr( A_Now DllCall( "Sleep", UInt,1000 ),9,4 ) >= "1200" )
   ShutDown, 8


Smile
_________________
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1233

PostPosted: Thu Jul 03, 2008 12:39 am    Post subject: Reply with quote

(fyi: 12pm == noon)

If you mean midnight, replace >= "1200" with <= 1 in the code SKAN posted.
_________________
My Home Thread [New: Vector Function Library]
More Common Answers: 1. It's in the FAQ 2. Ternary ( ? : ) guide 3. Post code with [code][/code] tags
Back to top
View user's profile Send private message
habs42
Guest





PostPosted: Thu Jul 03, 2008 2:09 pm    Post subject: Reply with quote

I meant noon and I want to put this script on start up so everyday at noon the pc will restart on its own

I have to replace SKAN's shutdown, 8 with shutdown, 6

thanks for your help guys
Back to top
habs42
Guest





PostPosted: Thu Jul 03, 2008 2:20 pm    Post subject: Reply with quote

will this work on any computer? and will the time zones mess with the time?
Like if I put this on a pc in Europe and I'm in North America will it shut down at their noon or our noon?
Back to top
SKAN



Joined: 26 Dec 2005
Posts: 6084

PostPosted: Thu Jul 03, 2008 2:27 pm    Post subject: Reply with quote

@habs42

Quote:
will this work on any computer?


Only Windows PC

Quote:
and will the time zones mess with the time?


No

Quote:
Like if I put this on a pc in Europe and I'm in North America will it shut down at their noon or our noon?


It will use the local system time ( Shown on TNA ) of the machine it is running on.


Smile
_________________
Back to top
View user's profile Send private message
habs42



Joined: 03 Jul 2008
Posts: 19

PostPosted: Fri Jul 04, 2008 6:25 pm    Post subject: Reply with quote

SKAN,
If I want to change the time to 15 minutes ahead
in this script :

Code:
#SingleInstance, ignore
#NoTrayIcon
Loop
{
If ( SubStr( A_Now DllCall( "Sleep", UInt,1000 ),9,4 ) = "1200" )
ShutDown, 6
}
 

instead of ="1200" would it be ="1215"
and If I want to change it to 15 minutes behind it would be ="1145" ?
Back to top
View user's profile Send private message Visit poster's website
Razlin



Joined: 05 Nov 2007
Posts: 417
Location: canada

PostPosted: Fri Jul 04, 2008 6:30 pm    Post subject: Reply with quote

yes thats correct
_________________
-=Raz=-
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group