Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mike Yearwood
  Where is Mike Yearwood?
 Toronto
 Canada
 Mike Yearwood
 Tags
Subject: Windows Task Scheduler Weird
Thread ID: 416540 Message ID: 416540 # Views: 46 # Ratings: 0
Version: Visual FoxPro 8 Category: Windows 7 and VFP
Date: Tuesday, December 30, 2014 9:33:09 PM         
   


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

Mike Yearwood
Microsoft MVP Visual FoxPro 2008, 2009
We have enough youth. We need a fountain of smart!
There may be many ways to skin a cat, but there are very few right ways to do it.

ENTIRE THREAD

Windows Task Scheduler Weird Posted by Mike Yearwood @ 12/30/2014 9:33:09 PM