11.07.2015 Views

Automate Scheduler Using Macros

Automate Scheduler Using Macros

Automate Scheduler Using Macros

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 4: CollectionsCompletedJobs CollectionDescriptionAn object that groups and provides access to CompletedJob objects.DiscussionCollections group objects. Access the CompletedJob objects in theCompletedJobs collection, to determine the properties of the completedtasks.ExampleThis example displays all completed tasks and enables the user to deletethem.Sub Main()Dim objSchedApp As ObjectDim objCompletedTasks As ObjectDim objCompletedTask As ObjectDim intCounter As IntegerDim strTaskDescription As StringSet objSchedApp = CreateObject("CognosBatcher.Application")Set objCompletedTasks = objSchedApp.Completed'this loop will start with the most recently completed tasksFor intCounter = objCompletedTasks.Count To 1 Step -1With objCompletedTasks.Item(intCounter)Set objCompletedTask = _objCompletedTasks.Item(intCounter).SchedulestrTaskDescription = objCompletedTask.ScheduleDescriptionintResponse = MsgBox("Delete this task?" & Chr(13) & _strTaskDescription, 292, "Completed Task" & _Str(intCounter))If intResponse = 6 ThenIf objCompletedTask.ExecuteOn = 6 and _.HasErrors True ThenintResponse = MsgBox _("View results for this task before deleting?" & _Chr(13) & strTaskDescription, 292, "View Results")If intResponse = 6 Then'view the results of the task.ViewResultsEnd IfintResponse = MsgBox _("Send the results of this task before deleting" & _Chr(13) & strTaskDescription, 292, "Send Results")If intResponse = 6 Then'send the results of the task.SendResultsEnd IfEnd If'the Delete method will remove the specified completed'task from the list of complete tasks..DeleteEnd IfEnd With22 <strong>Automate</strong> <strong>Scheduler</strong> <strong>Using</strong> <strong>Macros</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!