IScheduledTaskPeriodWeekly.DaysOfWeek

Syntax

DaysOfWeek(Index: CalendarDayOfWeek): Boolean;

Parameters

Index is a day, for which it should be determined whether the calculation took place.

Description

The DaysOfWeek property determines whether the calculation is performed on the day, index of which is passed by the Index parameter. If the property is set to True, the calculation is performed.

Example

Executing the example requires that the repository contains a scheduled tasks container with the TASK_CONTAINTER identifier and a unit with the Module_1 identifier. The unit contains the Main procedure.

Sub Main;

Var

MB: IMetabase;

CrInfo: IMetabaseObjectCreateInfo;

MObj: IMetabaseObject;

Exe: IExecuteSubScheduledTask;

Per: IScheduledTaskPeriodWeekly;

Prop: IScheduledTaskProperties;

i: Integer;

Begin

MB := MetabaseClass.Active;

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_TASK_EXECUTESUB;

CrInfo.Id := "MODULE_EXECUTOR";

CrInfo.Name := "Module execution";

CrInfo.Parent := MB.ItemById("TASK_CONTAINTER");

MObj := MB.CreateObject(CrInfo).Edit;

Exe := MObj As IExecuteSubScheduledTask;

Exe.Assembly := (MB.ItemById("Module_1").Bind As IModule).Assembly;

Exe.SubName := "Main";

Prop := Exe.Properties;

Per := Prop.CreatePeriod(ScheduledTaskPeriodType.Weekly) As IScheduledTaskPeriodWeekly;

For i := 1 To 5 Do

Per.DaysOfWeek(i As CalendarDayOfWeek) := True;

End For;

Per.EveryWeeks := 2;

Per.StartTime := DateTime.ComposeTimeOfDay(12, 0, 0, 0);

Prop.Period := Per;

MObj.Save;

End Sub Main;

After executing the example a new task of unit execution is created in the scheduled tasks container. The unit will be running from Monday till Friday at 12:00. Interval is week over week.

See also:

IScheduledTaskPeriodWeekly