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: PropertiesExample 1This example demonstrates the use of the ExecuteOn property of theOptions object.Sub Main()Dim objSchedApp As ObjectDim objOptions As ObjectSet objSchedApp = CreateObject("Cognosbatcher.application")Set objOptions = objSchedApp.Options'an ExecuteOn property value of 5 indicates new tasks are'defaulted to local execution; a value of 6, indicates new tasks'are defaulted to server execution.If objOptions.ExecuteOn = 5 ThenMsgBox "<strong>Scheduler</strong> is currently configured to default new " & _"tasks to run locally."ElseIf objOptions.ExecuteOn = 6 ThenMsgBox "<strong>Scheduler</strong> is currently configured to default new " & _"tasks to run on the server."End IfSet objOptions = NothingSet objSchedApp = NothingEnd SubExample 2This example schedules a server task that runs every day at 6:45pmoverwriting the previous result set.Sub Main()Dim objSchedApp As ObjectDim objNewTask As ObjectSet objSchedApp = CreateObject("CognosBatcher.Application")Set objNewTask = CreateObject("CognosBatcher.Schedule")With objNewTask.ScheduleType = 1.ScheduleDescription = "My new server task".ScheduleName = "c:\MyReports\MyServerReport.imr"'an ExecuteOn value of 1 indicates execution is to'take place on a server;'a value of 0 indicates execution on the local machine.ExecuteOn = 1.RecurCyc = 1.EffectiveFrom = Date.RunAtHour = 18.RunAtMin = 45'since this is a recurring task, overwrite'the previous result set'every time the task is run.SuppressMultipleResultSets = True.SaveEnd WithSet objNewTask = NothingSet objSchedApp = NothingEnd Sub<strong>Automate</strong> <strong>Scheduler</strong> <strong>Using</strong> <strong>Macros</strong> 69

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

Saved successfully!

Ooh no, something went wrong!