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 6: PropertiesExampleThis example displays all scheduled tasks and enables the user to createnew copies of them.Sub Main()Dim objSchedApp As ObjectDim objScheduledTasks As ObjectDim objNewTask As ObjectDim intCounter As IntegerDim intResponse As IntegerDim strTaskDescription As StringDim strTaskID as StringSet objSchedApp = CreateObject("CognosBatcher.Application")Set objScheduledTasks = objSchedApp.SchedulesFor intCounter = 1 to objScheduledTasks.CountstrTaskID = objScheduledTasks.Item(intCounter).ScheduleIDintResponse = MsgBox("Do you wish to create a new task " & _"based on thisone?" & _Chr(13) & "Task ID: " & strTaskID & _Chr(13) "Description: " & _objScheduledTasks.Item(intCounter).ScheduleDescription, _292, "Replicate this task?")If intResponse = 6 ThenSet objNewTask = CreateObject("CognosBatcher.Schedule")With objNewTask.Create<strong>Using</strong> (intCounter).RunAtHour = Val(InputBox("Enter the execution hour in "&_"24 hour format","Execution Time")).RunAtMin = Val(InputBox("Enter the execution minute "&_"format", "Execution Time")).EffectiveFrom = Date.SaveEnd WithSet objNewTask = NothingEnd IfNext intCounterSet objNewTask = NothingSet objScheduledTasks = NothingSet objSchedApp = NothingEnd Sub<strong>Automate</strong> <strong>Scheduler</strong> <strong>Using</strong> <strong>Macros</strong> 127

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

Saved successfully!

Ooh no, something went wrong!