Sign in to follow this  
Followers 0
van_renier

Help.. check for specific day in Month and the next day.

4 posts in this topic

How would I have Auto-It v3 check for;

"If the current Day is the 3rd Saturday of the month OR today is the day After the 3rd Saturday"

Yes/True: return/exit 1

No/False: return/exit 0

(The long story)

We have a scheduled outage timeframe for our mainframe servers. When our monitoring product detects an issue with the mainframe(s) during this time frame, we want to 'ignore' the event(s).

The difficult part of this is the time frame for this 'outage' is the 3rd Saturday of every month, between 11pm-1am. (meaning it goes over to the following Sunday's morning).

Using the monitoring products calendar component has proved to be too difficult for this, as while the 3rd Saturday is always the 3 Saturday, the next day (Sunday) might be the thrid of fourth Sunday of the month.

(so even if I take the time to implement this for the next year, the subsequent years' days/dates will be different.)

Thanks for any time/effort spent to helping me with this task.

Sincerely,

Van

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

ok well i think i've sorted what you need. hjeres the code fully commented because i had to re-assure myself:

;3rd sat or 3rd sun

;if sat is 1st day of month, date of 3rd sat is going to be 15th, sunday = 16th
;it sat is 7th day of month, date of 3rd sat is going to be 21st, sunday = 22nd

;the commands we're going to use
; @MDAY = day of month
; @WDAY = Weekday, Sunday[0],Monday[1]..,Saturday[6] etc

;so we want saturday 15th to 21st and sunday 16th - 22nd

if @WDAY = 6 and @MDAY >= 15 and @MDAY <=21 Then;if weekday = 6 (saturday) and day of month = 15th to 21st
;do what you need to for YES - Return,1 or whatever
Else
;do what you need for NO
EndIf

if @WDAY = 0 and @MDAY >= 16 and @MDAY <=22 Then;if weekday = 0 (dunsay) and day of month = 16th to 22st
;do what you need to for YES - Return,1 or whatever
Else
;do what you need for NO
EndIf

tell me if that helps?

Edited by Sarc

Share this post


Link to post
Share on other sites

ok well i think i've sorted what you need. hjeres the code fully commented because i had to re-assure myself

Sarc,

THANKS A LOT.

I'm not sure if there's any difference between the versions you and I are running, but the @WDAY variable returns a value between 1-7, not 0-6 (I think it did in the past though, not sure).

Anyways, I saw your script and realized how easy it should've been - of course, I would've never known without your input/advice/code samples.

Thanks, Again!

Sincerely,

Van

Share this post


Link to post
Share on other sites

i wanted to read and try to help but your Avitar is so annoying..

i couldn't concentrate

might want to think about changing that

8)


NEWHeader1.png

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