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: PropertiesExample 1This first example demonstrates the ExecuteAt, RunAtHour andRunAtMin properties of the Options objectSub Main()Dim objSchedApp As ObjectDim objOptions As ObjectDim intResponse As IntegerDim strQualifier As StringSet objSchedApp = CreateObject("Cognosbatcher.Application")Set objOptions = objSchedApp.OptionsWith objOptionsIf .ExecuteAt=2 Then'<strong>Scheduler</strong> is set to use immediate execution as the'default for new tasksintResponse = msgbox("<strong>Scheduler</strong> is currently configured "&_" to default new tasks to immediate execution. Do you "&_" wish to change this?" ,259,"Immediate Execution")If intResponse = 6 Then.ExecuteAt = 7'switch to using the specified time in RunAtHour'and RunAtMin properties of the Options object.RunAtHour = val(inputbox("Type in a new default " & _"execution hour (24 hour clock) for new tasks or " & _"press ENTER to accept the current setting. ", _"Default Execution Hour",.RunAtHour)).RunAtMin = val(inputbox("Type in a new default" &_"execution minute for new tasks or press ENTER " & _"to accept the current setting. ", _"Default Execution Minute",.RunAtMin)).SaveEnd IfElseIf .ExecuteAt = 7 Then'<strong>Scheduler</strong> is set to use specified time execution'as the default for new tasksintResponse = msgbox("<strong>Scheduler</strong> is currently configured " & _"to default new tasks to execution at a specified time. " & _"Do you wish to change this?",259,"Delayed Execution")If intResponse = 6 Then.ExecuteAt = 2'switch to immediate execution as the default'for new tasksEnd IfEnd IfEnd WithSet objOptions = NothingSet objSchedApp = NothingEnd Sub120 <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!