PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • Details of the TriggerScheduledTask structure
  • Variables that can be used according to the type of task
  • Example
  • Example for adding a task
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
The TriggerScheduledTask structure is used to define all the events that will define the execution of a task. The variables of this structure are re-initialized by SchedulerReset.
This structure must be filled before using SchedulerAddTrigger or SchedulerAddTask.
The default schedule is a daily task run at 9:00 AM.
Details of the TriggerScheduledTask structure
The parameters that must be entered in the TriggerScheduledTask structure depend on the type of schedule defined for the scheduled task.
Indeed, a scheduled task can be: run on a daily, weekly or monthly basis, run once, run when the computer is started, run when the system is idle.
The type of schedule defined for the scheduled task is specified by the TriggerScheduledTask.Type variable. The table below presents this variable as well as all the other variables of the TriggerScheduledTask structure.
TriggerScheduledTask.TypeThis variable can take one of the following values:
schedLogonRun when starting a session.
schedSystemStartRun when the system is started.
schedWeeklyRun on a weekly basis.
schedIdleRun when the system is idle.
schedMonthlyRun on a monthly basis.
schedDaily
(default value)
Run on a daily basis
schedOnceRun once.
TriggerScheduledTask.ForcedStopBoolean.
If this parameter is set to True, stops the task currently run when the repeat duration is exceeded.
This variable is set to False by default.
Type of associated task: Daily task, weekly task, monthly task and task run once.
TriggerScheduledTask.DateDate
Date when the task will be run.
Type of associated task: Task run once only.
TriggerScheduledTask.BeginDateDate
Date from which the task can be performed. By default, this date corresponds to the creation date of the task.
Type of associated task: Daily task, weekly task and monthly task.
TriggerScheduledTask.EndDateDate
Date from which the task will no longer be performed. To specify no end date, use an empty string.
No end date is specified by default.
Type of associated task: Daily task, weekly task and monthly task.
TriggerScheduledTask.IdleWaitInteger in minutes
Amount of idle time required before performing the task. This duration is set to 10 minutes by default.
Type of associated task: Run when the system is idle
TriggerScheduledTask.RepeatDurationInteger in minutes.
The task will be repeated during the specified duration. This duration is set to 60 minutes by default.
Type of associated task: Daily task, weekly task and monthly task.
TriggerScheduledTask.TimeTime
Time when the task will be run. This variable is set to 9:00 AM by default
Type of associated task: Daily task, weekly task, monthly task and task run once.
TriggerScheduledTask.IntervalInteger
Number of days or number of weeks between each execution. This variable is set to 1 by default.
Type of associated task: Daily task or weekly task.
TriggerScheduledTask.DayInteger
The task will be performed on this day of the month. Can correspond to:
  • the number of a day (between 1 and 31)
  • the name of a day + its position in the month
Example: 1st Monday of the month: schedMonday + schedFirst
The available values are:
  • schedMonday, schedTuesday, schedWednesday, schedThursday, schedFriday, schedSaturday, schedSunday
  • schedFirst, schedSecond, schedThird, schedFourth, schedLast.
The task is performed every 1st of each month by default.
Type of associated task: Monthly task
TriggerScheduledTask.DayOfWeekInteger
The task will be performed on this day of the week. Corresponds to the name of a day + its position in the month
Example: 1st Monday of the month: schedMonday + schedFirst
The available values are: schedMonday, schedTuesday, schedWednesday, schedThursday, schedFriday, schedSaturday, schedSunday
The task is performed every Monday by default.
Type of associated task: Weekly task
TriggerScheduledTask.CaptionCharacter string
Caption of the schedule, which means caption of the event that triggers the scheduled task.
This variable is read-only and it is updated when reading a schedule (SchedulerTriggerProperties)
TriggerScheduledTask.MonthInteger
The task will be performed during this month. Corresponds to one or more months: schedJanuary, schedFebruary, schedMarch, schedApril, schedMay, schedJune, schedJuly, schedAugust, schedSeptember, schedOctober, schedNovember, schedDecember.
Example: schedJanuary + schedAugust: the task will be performed in January and in August.
The task is performed every month by default.
Type of associated task: Monthly task
TriggerScheduledTask.RepeatIntervalInteger in minutes
The task will be repeated during this interval (0 if the task must be performed once). The task is not repeated by default.
Type of associated task: Daily task, weekly task, monthly task and task run once.
Variables that can be used according to the type of task
The table below presents the variables that can be used according to the type of task:
schedLogonNo specific variable
schedSystemStartNo specific variable
schedWeeklyTriggerScheduledTask.Time
TriggerScheduledTask.Interval
TriggerScheduledTask.BeginDate
TriggerScheduledTask.EndDate
TriggerScheduledTask.RepeatInterval
TriggerScheduledTask.RepeatDuration
TriggerScheduledTask.ForcedStop
schedIdleNo specific variable
schedMonthlyTriggerScheduledTask.Time
TriggerScheduledTask.Day
TriggerScheduledTask.Month
TriggerScheduledTask.BeginDate
TriggerScheduledTask.EndDate
TriggerScheduledTask.RepeatInterval
TriggerScheduledTask.RepeatDuration
TriggerScheduledTask.ForcedStop
schedDailyTriggerScheduledTask.Time
TriggerScheduledTask.Interval
TriggerScheduledTask.BeginDate
TriggerScheduledTask.EndDate
TriggerScheduledTask.RepeatInterval
TriggerScheduledTask.RepeatDuration
TriggerScheduledTask.ForcedStop
schedOnceTriggerScheduledTask.Time
TriggerScheduledTask.Date
TriggerScheduledTask.RepeatInterval
TriggerScheduledTask.RepeatDuration
TriggerScheduledTask.ForcedStop
Example

Example for adding a task

SchedulerReset()
// Create the scheduled task
ScheduledTask.Application = "MyExecutable.exe"
ScheduledTask.CommandLine = QryAllAboutBackup.Name
ScheduledTask.SystemOn = True
ScheduledTask.Comment = "WinDev program"

// Create the schedules for the scheduled task
// RADIO_BackupType is a radio button proposing
// a single backup, a weekly backup or a monthly backup ...

TriggerScheduledTask.Type = RADIO_BackupType

// Execution date of the single backup
IF RADIO_nBackupType = schedDaily THEN
IF EDT_SingleDate <> "" THEN
IF EDT_SingleTime <> "" THEN
TriggerScheduledTask.Date = EDT_SingleDate
TriggerScheduledTask.Time = EDT_SingleTime
ELSE
Info("Enter a valid backup time.")
RETURN
END
ELSE
Info("Enter a valid backup date.")
RETURN
END
END
// Monthly backup
IF RADIO_BackupType = schedMonthly THEN
IF EDT_SingleTime <> "" THEN
TriggerScheduledTask.Day = RADIO_DayOfMonth
TriggerScheduledTask.Time = EDT_SingleTime
ELSE
Info("Enter a valid backup time.")
RETURN
END
END
// Weekly backup
IF RADIO_BackupType = schedWeekly THEN
IF EDT_SingleTime <> "" THEN
TriggerScheduledTask.DayOfWeek = RADIO_DayOfWeek
TriggerScheduledTask.Time = EDT_SingleTime
ELSE
Info("Enter a valid backup time.")
RETURN
END
END
IF not SchedulerAddTask("MyTask") THEN
Error(ErrorInfo())
ELSE
Info("The application was added to the task manager of Windows")
END
Minimum required version
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment