Skip to content

Latest commit

 

History

History
398 lines (199 loc) · 10.9 KB

PyIScheduledWorkItem.md

File metadata and controls

398 lines (199 loc) · 10.9 KB

PyIScheduledWorkItem

PyIScheduledWorkItem Object

Python object that encapsulates the IScheduledWorkItem interface

Methods

  • CreateTrigger

    Creates a new trigger for a task, returns index and new ITaskTrigger interface 

  • DeleteTrigger

    Deletes specified trigger 

  • GetTriggerCount

    Returns number of triggers defined for the task 

  • GetTrigger

    Retrieves ITaskTrigger interface for specified trigger index 

  • GetTriggerString

    Creates a human-readable summary of specified trigger 

  • GetRunTimes

    Return specified number of run times within given time frame 

  • GetNextRunTime

    Returns next time that task is scheduled to run 

  • SetIdleWait

    Sets idle parms for task with trigger of type TASK_EVENT_TRIGGER_ON_IDLE 

  • GetIdleWait

    Gets idle parms for task with trigger of type TASK_EVENT_TRIGGER_ON_IDLE 

  • Run

    Starts task 

  • Terminate

    Terminate process if task is running 

  • EditWorkItem

    Brings up standard Scheduled Task dialog 

  • GetMostRecentRunTime

    Returns last time task ran 

  • GetStatus

    Returns status (SCHED_S_TASK... constants) 

  • GetExitCode

    Returns tuple of task's exit code and error returned to Task Scheduler if process could not start 

  • SetComment

    Set comment string for task 

  • GetComment

    Return comment string associated with task. 

  • SetCreator

    Specify who (or what) created task, can be any string 

  • GetCreator

    Returns creator info, can be any string data 

  • SetWorkItemData

    Set data associated with task (treated as uninterpreted bytes) 

  • GetWorkItemData

    Retrieve data associated with task 

  • SetErrorRetryCount

    Specify nbr of times to attempt to run task if it can't start (not currently implemented) 

  • GetErrorRetryCount

    Return nbr of times Task scheduler should try to run task (not currently implemented) 

  • SetErrorRetryInterval

    Interval in minutes between attempts to run task. Not implemented according to SDK 

  • GetErrorRetryInterval

    Returns nbr of minutes between attempts to run task. Not implemented according to SDK 

  • SetFlags

    Set flags for task 

  • GetFlags

    Returns flags for task (TASK_FLAG_* constants) 

  • SetAccountInformation

    Set username and password under which task will run 

  • GetAccountInformation

    Returns username that task will run under 

PyIScheduledWorkItem.CreateTrigger

int,PyITaskTrigger = CreateTrigger() Creates a new trigger for a task, returns index and new ITaskTrigger interface

PyIScheduledWorkItem.DeleteTrigger

DeleteTrigger(Trigger) Deletes specified trigger

Parameters

  • Trigger : int

    Index of trigger to delete

EditWorkItem(hParent, dwReserved) Brings up standard Scheduled Task dialog

Parameters

  • hParent : PyHANDLE

    Reserved, use 0 or None if passed

  • dwReserved : int

    Reserved, use 0 if passed

PyIScheduledWorkItem.GetAccountInformation

PyUNICODE = GetAccountInformation() Returns username that task will run under

PyUnicode = GetComment() Return comment string associated with task.

GetCreator() Returns creator info, can be any string data

PyIScheduledWorkItem.GetErrorRetryCount

GetErrorRetryCount() Return nbr of times Task scheduler should try to run task (not currently implemented)

PyIScheduledWorkItem.GetErrorRetryInterval

GetErrorRetryInterval() Returns nbr of minutes between attempts to run task. Not implemented according to SDK

(int,int) = GetExitCode() Returns tuple of task's exit code and error returned to Task Scheduler if process could not start

int = GetFlags() Returns flags for task (TASK_FLAG_* constants)

int,int = GetIdleWait() Gets IdleMinutes and DeadlineMinutes parms for task with trigger of type TASK_EVENT_TRIGGER_ON_IDLE

PyIScheduledWorkItem.GetMostRecentRunTime

PyTime = GetMostRecentRunTime() Returns last time task ran

PyIScheduledWorkItem.GetNextRunTime

PyTime = GetNextRunTime() Returns next time that task is scheduled to run

(PyTime,,,) = GetRunTimes(Count, Begin

, End

) Return specified number of run times within given time frame

Parameters

  • Count : int

    Number of run times to retrieve

  • Begin : PyTime

    Start time, defaults to current time if not passed or None

  • End : PyTime

    End time, defaults to unlimited if not passed or None

int = GetStatus() Returns status (SCHED_S_TASK... constants)

PyITaskTrigger = GetTrigger(iTrigger) Retrieves ITaskTrigger interface for specified trigger index

Parameters

  • iTrigger : int

    Index of trigger to retrieve

PyIScheduledWorkItem.GetTriggerCount

int = GetTriggerCount() Returns number of triggers defined for the task

PyIScheduledWorkItem.GetTriggerString

PyUNICODE = GetTriggerString() Creates a human-readable summary of specified trigger

PyIScheduledWorkItem.GetWorkItemData

string = GetWorkItemData() Retrieve data associated with task

Run() Starts task

PyIScheduledWorkItem.SetAccountInformation

SetAccountInformation(AccountName, Password) Set username and password under which task will run

Parameters

  • AccountName : unicode

    AccountName, use "" for local system account (can only be used by Administrators)

  • Password : unicode

    Password - Can be None for local System account, or if TASK_FLAG_RUN_ONLY_IF_LOGGED_ON is set

Comments

On some systems, username and password are verified at the time the task is saved, on others when the task tries to run

SetComment(Comment) Set comment string for task

Parameters

  • Comment : unicode

    Freeform comment string

SetCreator(Creator) Specify who (or what) created task, can be any string

Parameters

  • Creator : unicode

    Originator of task, does not have to be valid username

PyIScheduledWorkItem.SetErrorRetryCount

SetErrorRetryCount(wRetryCount) Specify nbr of times to attempt to run task if it can't start (not currently implemented)

Parameters

  • wRetryCount : int

    Nbr of attemps to start task

PyIScheduledWorkItem.SetErrorRetryInterval

SetErrorRetryInterval(RetryInterval) Interval in minutes between attempts to run task. Not implemented according to SDK

Parameters

  • RetryInterval : int

    Interval in minutes

SetFlags(dwFlags) Set flags for task

Parameters

  • dwFlags : int

    Combination of TASK_FLAG_* constants

SetIdleWait(wIdleMinutes, wDeadlineMinutes) Sets idle parms for task with trigger of type TASK_EVENT_TRIGGER_ON_IDLE

Parameters

  • wIdleMinutes : int

    Nbr of minutes computer must be idle before task fires

  • wDeadlineMinutes : int

    Maximum nbr of minutes task will wait for computer to become idle

PyIScheduledWorkItem.SetWorkItemData

SetWorkItemData(Data) Set data associated with task (treated as uninterpreted bytes)

Parameters

  • Data : string

    Character data, treated as uninterpreted bytes

Terminate() Terminate process if task is running