AutoHotkey Community

It is currently May 26th, 2012, 3:41 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Using the AND Operator
PostPosted: March 20th, 2009, 12:48 pm 
Offline

Joined: August 1st, 2008, 3:16 pm
Posts: 16
Hi

I am struggling to use the AND operator in conjunction with If.

All I want to do is detect whether the time is between 9 and 17.00.

My script is below:
If A_Hour >= 09 AND A_Hour <= 16
{
_OfficeHours = Yes
}

I realise I could do it like this, but it is not as neat:
If A_Hour >= 09
{
If A_Hour <= 16
_OfficeHours = Yes
}

Any suggestions would helpful.

Thanks
Rob


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2009, 12:56 pm 
Code:
If (A_Hour >= 09) AND (A_Hour <= 16)
  msgbox, OfficeHours = Yes
else
  msgbox, OfficeHours = No


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 20th, 2009, 1:40 pm 
Offline

Joined: August 1st, 2008, 3:16 pm
Posts: 16
Thanks, worked a treat, I was unaware if the need for brackets.

Much appreciated

Rob


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group