Mike Yearwood
Toronto, Ontario, Canada
General information
Category:
Coding, syntax & commands
Title:
Windows Task Scheduler
Environment versions
Network:
Windows 2008 Server
Hey all
I'm working with the Windows Task Scheduler and I've seen something weird.
service=createobject("schedule.service")
service.connect()
rootfolder=service.getfolder()
oTasks=rootfolder.gettasks(0)\
FOR EACH task in oTasks
IF task.path == "some task"
oTask = task
ENDIF
ENDFOR
oTaskDef = oTask.Definition
oTrigger = oTaskDef.Triggers.Item[1]
The kind of trigger may be Daily, Weekly, Monthly and will have various properties.
oTrigger.DaysInterval has to exist on a daily trigger, but not on a weekly trigger.
I tried with PEMSTATUS()
IF PEMSTATUS(oTrigger,"DaysInterval",5)
ADDPROPERTY(poParms,"DaysInterval",oTrigger.DaysInterval)
ENDIF
It never detects the DaysInterval even on the Daily trigger.
I ended up using TRY like this
TRY
ADDPROPERTY(poParms,"DaysInterval",oTrigger.DaysInterval)
CATCH TO loError
ENDTRY
But I would like to know how to apply pemstatus and why it doesn't work for education's sake.
Thanks
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only