Scheduler every first Monday of month

Discuss RoboTask here
Post Reply
spotsphill
Posts: 9
Joined: Tue Nov 25, 2008 12:25 pm
Location: United States
Contact:

Scheduler every first Monday of month

Post by spotsphill »

Greetings:Is there a way to schedule a task to run every first Monday of the month?  If so, how would I do it?Thanks!
Last edited by spotsphill on Mon Mar 16, 2009 6:28 pm, edited 1 time in total.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Scheduler every first Monday of month

Post by Oleg »

the first Monday may be between 1 to 7 day of each month.
So do the following:
- Attach to the task Scheduler triggering event with "Every week" parameter and check the Monday and uncheck other days of week.
- In the task check current day of month:

if {Day} <= 7 then
   .......
   do something
   .......
end if
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Scheduler every first Monday of month

Post by Oleg »

Also,
each second Monday - between 8 and 14 day of the month
each third Moday - between 15 and 21 day of the month
fourth Monday - between 22 and 28 day of the month

The same calculation is valid for other days of the week.
spotsphill
Posts: 9
Joined: Tue Nov 25, 2008 12:25 pm
Location: United States
Contact:

Scheduler every first Monday of month

Post by spotsphill »

GREAT!A follow up question would be:How do I do "between 8 and 14 day of the month" ??----------Also, is there a way to do "every 2 weeks on Monday" (ie - one Monday yes, one Monday no)?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Scheduler every first Monday of month

Post by Oleg »

if {Day} >= 8 then
   if {Day} <= 14 then
   ...
   do something
   ...
   end if
end if
Last edited by Oleg on Tue Mar 17, 2009 9:57 am, edited 1 time in total.
spotsphill
Posts: 9
Joined: Tue Nov 25, 2008 12:25 pm
Location: United States
Contact:

Scheduler every first Monday of month

Post by spotsphill »

SWEET!  Thanks as always!
waldo
Posts: 56
Joined: Fri Sep 24, 2004 3:36 am

Scheduler every first Monday of month

Post by waldo »

This thread does not state which version of Robotask is being used...I assume version 3. 
Anyway, I am thinking about updating to version 4.1...Does the newest version have an automatic way to determine the 1st, 2nd, 3rd, 4th and sometimes 5th Friday of the month? 
The task I need done is simple....Copy files from the same folder each Friday---but the destination folder is different depending on whether its the 1st, 2nd, 3rd, 4th or sometimes 5th Friday of the month. 
For example, the destination folder on the first Friday of the month is named, First_Friday...the same logic applies to the destination folder names on the other Fridays {Second_Friday, etc.}.  I know that when the first Friday of the new month comes---it will over write the files in the destination First Friday folder and that is fine. 
If this still takes basic coding to accomplish, can you provide a working example?  Thanks
 
waldo
Posts: 56
Joined: Fri Sep 24, 2004 3:36 am

Scheduler every first Monday of month

Post by waldo »

I have managed to solve all of my issues regarding Friday, except for the 5th Friday of the month.  This generally occurs only 4 times a year.  In 2011, it occurs in April, July, September and December.
I need the Robotask job to be unique on these Fridays...Is there any way to programmically identify a 5th Friday in a month?    I looked at 2012, and its different months in this year that have a 5th Friday:  March, June, August and November. 
Finally, the fifth Friday, if there is one, will be either the 29, 30 or 31...so I would need the logic to determine:
1.  If its a Friday, AND then
2.  If its either the 29, 30, 31...if so, then the robotask scheduler triggers the job..if not, no job is initialized. 
Can this be done?  Thank you.
 
 
Last edited by waldo on Tue Aug 24, 2010 3:28 pm, edited 1 time in total.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Scheduler every first Monday of month

Post by Oleg »

I think the algorithm will be such:

if {DayOfWeekNo} = 6 //friday, Sunday = 1
   if {Day} <= 28
   ...
   do something
   ...
   End If
End If

The 5-th Friday always will be AFTER 28-th day of month.
Of course, this assertion can be applied to any day of week.
Post Reply