Get every 5 weeks
Posted: 02 Mar 2023, 01:48
I am trying to make a bit of code, but cannot even imagine how it would work.
What I would really like is my macro to tell me if this week is week 1, 2, 3, 4, or 5.
If it is week 5, on Sunday at midnight it will turn to week 1.
The reason I need this is because I am making a scheduler within my program that will do certain things if it is week 2 or 5, but I am stuck and am not even sure where to start. I have managed roughly 4300 lines of code in this macro without getting help, but I am stumped!
This is what I have been staring at for the last 3 days trying to figure out how to make it do what I want to do, but my brain can't even comprehend the next step.
It gives me 27 (days since var2). Today should be week 5, next week should be week 1. Every time I think I get somewhere, I would have to be running the macro during a certain week to make it work properly without giving me an incorrect week number. I would like to be able to start this up any day or month, and be on the proper week number. I'm bamboozled, I hope you guys might have an idea!
Thank you!
[Mod action: Moved topic to v1 section. The main section is for v2.]
What I would really like is my macro to tell me if this week is week 1, 2, 3, 4, or 5.
If it is week 5, on Sunday at midnight it will turn to week 1.
The reason I need this is because I am making a scheduler within my program that will do certain things if it is week 2 or 5, but I am stuck and am not even sure where to start. I have managed roughly 4300 lines of code in this macro without getting help, but I am stumped!
This is what I have been staring at for the last 3 days trying to figure out how to make it do what I want to do, but my brain can't even comprehend the next step.
Code: Select all
var1 := A_YYYY . A_MM . A_DD
var2 := 20230202 ; this date marks the start of rotating team 1
EnvSub, var1, %var2%, days
MsgBox, %var1%
Thank you!
[Mod action: Moved topic to v1 section. The main section is for v2.]