Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


David Tatum
2017-05-17T16:22:09Z
Example:

Job 1 - Triggers daily at 12:05 am
- Task 1 - Runs immediately when Job 1 starts
- Task 2 - Shouldn't start before 5:00 am
- Task 3 - Shouldn't start before 8:00 am
- Task 4 - Shouldn't start before 12:00 pm

I found the Wait task, but that would require waiting a specific amount of time after the previous task completes. I need Task 2 to start at 5:00 am after Task 1 completes, regardless of how long Task 1 takes to complete. Can this be done easily?
Sponsor
Forum information
ErikC
2017-05-18T07:04:29Z
Hi david, Welcome to the forum!!

What you can try is making three .NET conditions. Each condition has different parameter values setting the time.

Here is the code to do this:
using System;

public class Test
{
 // a VisualCron Condition must return a boolean which is the result of the Condition
 
 // This condition checks if a specific time has met.
 // Current time before Hour24:Minute -> Return FALSE
 // Current time past   Hour24:Minute -> Return TRUE
 public static bool MyCustomTimeCondition(int Hour24, int Minute)
 {
 	 DateTime check = new DateTime(DateTime.Now.Year,DateTime.Now.Month,DateTime.Now.Day,Hour24,Minute,0);
     return ((TimeSpan)check.Subtract(DateTime.Now)).Ticks < 0;     
 }
}

One conditoin should have Hour24 = 5, Minute = 0, the next Hour24=8, Minute=0, you get it I think.

The actions should check the result of the condtion and retry the task with a wait. Because this method return TRUE when the setup time is past, you should use the On match All/Any to set to continue, and the Match non to retry with a wait.
So task 2 to 4 have contitions.

Good luck,
Erik
Uses Visualcron since 2006.
Gary_W
2017-05-23T15:44:25Z
I just set up an example in my test group as I was wondering about something like this myself. I suspect with some tweaking it could be adapted for your needs. At any rate it might give you some ideas or at least another way to approach the problem. I'll do my best to explain.

I set up a timeTrigger test job with 2 job variables, TimeTrigger and TimeTriggerMet. TimeTrigger holds the time I want the second task to start and TimeTriggerMet is a flag that indicates when that time has been met:

UserPostedImage

The tasks I call are popups for testing, but in reality they would be jobs that could be called asynchronously.
First task initialize job variable(s).
2nd task is the first job to run.
3rd task sets the timeTriggerMet variable and consists of one line: {LOGIC(If|String|{JOB(Active,Variable,TimeTrigger)}|==|{TIME()}|1|0)}
If the time is not met, set to 0, when the time is met, set to 1.
The time is in the format "11:34 AM". Note it has a loop that runs until the TimeTriggerMet = 1 (true)

UserPostedImage

The 4th task is popup 2 which has a condition set consisting of 2 conditions. popup 1 task must be done (IsRunning = FALSE) AND the TimeTriggerMet variable must equal 1.
This simple example works fine so please give it a try.

At any rate, please report back and let us know your solution.
Scroll to Top