11.07.2015 Views

Automate Scheduler Using Macros

Automate Scheduler Using Macros

Automate Scheduler Using Macros

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 6: PropertiesExampleThis example displays all completed tasks and their related details.Sub Main()Dim objSchedApp As ObjectDim objCompletedTasks As ObjectDim objCompletedTask As ObjectDim intCounter As IntegerDim strErrors As StringDim strStartedAt As StringDim strEndedAt As StringDim strLastSeen As StringDim strTaskDescription As StringSet objSchedApp = CreateObject("CognosBatcher.Application")Set objCompletedTasks = objSchedApp.CompletedFor intCounter = 1 To objCompletedTasks.CountWith objCompletedTasks.Item(intCounter)If .HasErrors ThenstrErrors = "Error: " & .ErrorMessageElsestrErrors = "No Errors"End IfstrStartedAt = .StartTimestrEndedAt = .EndTimeIf Not(.LastViewed=&H0) ThenstrLastSeen = "Last Viewed: " & str(.LastViewed)ElsestrLastSeen = "Results not yet viewed."End IfSet objCompletedTask = _objCompletedTasks.Item(intCounter).SchedulestrTaskDescription = objCompletedTask.ScheduleDescriptionMsgBox strTaskDescription & Chr(13) & "Start Time: " & _strStartedAt & Chr(13) & "End Time: " & _strEndedAt & chr(13) strLastSeen & _chr(13) & strErrors, 64, "Completed Task " & Str(intCounter)End WithNext intCounterSet objCompletedTask = NothingSet objCompletedTasks = NothingSet objSchedApp = NothingEnd Sub<strong>Automate</strong> <strong>Scheduler</strong> <strong>Using</strong> <strong>Macros</strong> 65

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

Saved successfully!

Ooh no, something went wrong!