Task Object Scripting Extension

DESCRIPTION:

The Task object encapsulates an AutoMate™ task. Upon executing an AutoMate™ BASIC script, AutoMate™ automatically creates an instance of Task called CurrentTask that contains the information from current task being executed. Using the CurrentTask object, a task has the capability to modify itself from with the scripting language. Using the Task Object in the scripting language, AutoMate™ could create new tasks as well to respond to certain conditions. You may create additional instances of the Task within AutoMate™ Basic scripts as necessary.

Properties

TaskName

Read/Write

Variant

Task Name

LaunchDate

Read/Write

Variant

Launch Date in the system ShortDate format

LaunchTime

Read/Write

Variant

Launch Time

Frequency

Read/Write

Integer

Task Execution Frequency
0 = Once
1 = Every
2 = Manual

IntervalType

Read/Write

Integer

Task Execution Frequency
0 = Minute
1 = Hour
2 = Day
3 = Week
4 = Weekday
5 = Weekend
6 = Bi-week
7 = Month
8 = Quarter
9 = Year
10 = Second

Interval

Read/Write

Integer

Task Execution Frequency in IntervalTypes

RunLate

Read/Write

Integer

Controls Run Action When Task is Overdue
0 = Immediately
1 = Don’t Run
2 = Prompt

ScheduleLate

Read/Write

Integer

Controls Rescheduling When Task is Overdue
0 = Reschedule Relative to Original Date/Time

  1. Reschedule Relative to Launch Date/Time

    2 = Do Not Reschedule

Active

Read/Write

Integer

Controls Task Execution
1 = Task is Executing / Allowed to Execute
0 = Task will Stop Executing

Triggers

Read/Write

Integer

Task Triggers; combination of the following values:
0 = None (exclusive)
1 = Scheduled
2 = Windows Event (Message)
4 = Wait for a Window
8 = Hotkey

Hotkey

Read/Write

Variant

Trigger Hotkey

WindowName

Read/Write

Variant

Trigger Window Title

StepCount

Read Only

Integer

Number of Steps in Task

TaskData

Read/Write

Variant

Task Data in Raw, Internal Format

Details

Read/Write

Variant

Task Details

FrequencyString

Read Only

Variant

Task Frequency Display String

Events

Read/Write

Integer

Windows Events to Trigger On; combination of the following values:
1 = System Time has been Changed
2 = System is Low on Memory
4 = System Device has been Changed
8 = Display Mode has been Changed
16 = Color Palette has been Changed
32 = Spooler Count has Changed

Methods

Function GetTaskStep (StepNo As Integer) As Variant

Retrieves the string containing the specified task step. The first step is numbered 0. The string contains the task step command and parameters in the format that appears in the AutoMate™ step windows.

Example:

Sub Main

x = CurrentTask.GetTaskStep(0)

MsgBox x

'CurrentTask.DeleteTaskStep(1)

CurrentTask.AppendTaskStep(1, x)

End Sub

Function GetStepCommand (StepNo As Integer) As Variant

Retrieves the string containing the specified task step command. The first step is numbered 0.

Function GetStepParamCount (StepNo As Integer) As Integer

Retrieves the number of parameters in the specified task step.

Sub SetTaskStep (StepNo As Integer, NewAction As Variant)

Changes the specified task step. The NewAction parameter must be passed in the correct format for the new step to be valid.

Example:

Sub Main

CurrentTask.SetTaskStep(1,"OPEN")

End Sub

Function GetStepParameter (StepNo, Parameter As Integer) As Integer

Retrieves a string containing the specified task step parameter. The first step is numbered 0 and the first parameter is numbered 0.

Example:

Sub Main

X = CurrentTask.GetStepParameter(1,0)

End Sub

Sub AppendTaskStep (Action As Variant)

Adds a new task step. The Action parameter must be passed in the correct format for the new step to be valid.

Example:

Sub Main

x = CurrentTask.GetTaskStep(0)

MsgBox x

'CurrentTask.DeleteTaskStep(1)

CurrentTask.AppendTaskStep(1, x)

End Sub

Sub InsertTaskStep (Before As Integer, Action As Variant)

Inserts a new task step before the specified step. The Action parameter must be passed in the correct format for the new step to be valid.

Example:

Sub Main

x = CurrentTask.GetTaskStep(1)

CurrentTask.InsertTaskStep(3, x)

End Sub

Sub DeleteTaskStep (StepNo As Integer)

Deletes the specified step.

Example:

Sub Main

CurrentTask.DeleteTaskStep(3)

End Sub

Function GetStepStatus (StepNo As Integer) As Integer

Retrieves the status flag for the specified task step. A return value of 0 means the step is disabled (skipped), 1 means the step in enabled.

Example:

Sub Main

x = CurrentTask.GetStepStatus(1)

MsgBox x

End Sub

Function SetStepStatus (StepNo, Status As Integer) As Integer

Sets the status flag for the specified task step. Setting Status to 0 means the step is disabled (skipped), 1 means the step in enabled.

Example:

Sub Main

CurrentTask.SetStepStatus(1,1)

End Sub

Sub ClearSteps

Deletes all steps from the task.

Example:

Sub Main

CurrentTask.ClearSteps

MsgBox CurrentTask.TaskData

End Sub

Sub SaveToFile (FileName As Variant)

Save the task data to a file.

Example:

Sub Main

CurrentTask.SaveToFile("c:\testtask.txt")

End Sub

Sub LoadFromFile (FileName As Variant)

Loads the task data from a file.

Example:

Sub Main

CurrentTask.LoadFromFile("c:\testtask.txt")

End Sub

Related Topics:

Other Scripting Extensions

Scripting In AutoMate™

Run a BASIC Script Action