Hi,
I tried it today to solve this with the use of user variables. I came far, but It was to complex to continue.
So I ended up with one .NET task doing the logic and one condition.
You also have to have two triggers, one for the 1st Thursday (specific day of the month) and every Monday.
The .NET task (1st task in job) is a c# task with this code:
using System;
public class Test
{
public static bool mayRun()
{
if (DateTime.Today.DayOfWeek == DayOfWeek.Thursday && DateTime.Today.Day <= 7)
{
//1st Thursday of the week
return true;
}
else if (DateTime.Today.DayOfWeek == DayOfWeek.Monday && (DateTime.Today.AddDays(-4).Month == DateTime.Today.Month) && DateTime.Today.Day <= 11)
{
//1st Monday after the 1st Thursday
return true;
}
return false;
}
}
This code gives return value: True if it's the 1st Thurday of the month or the 1st Monday after the 1st Thursday of the month.
Using a condition you set on you 2nd task in your job, you check if the output of the .NET task is True.
If the condition matches you continue else you exit the job.
The next tasks in your job do not need the condition anymore.
Regards
Erik
Edited by user
2015-11-20T12:47:50Z
|
Reason: typo
Uses Visualcron since 2006.