Home All Groups Group Topic Archive Search About

task scheduler- eduardo scheduler

Author
20 Mar 2006 2:34 PM
Big D
I have been using a task scheduler from below site. So far it's been a great
scheduler with all the functionality to create a windows task.

http://www.mvps.org/emorcillo/en/code/vb6/index.shtml

My question is how can I set the "Stop task if it runs for x number of
hours"? By default the value is set to 72hrs. I would like to set this value
to 1 hr.

Below is the code to create a task that runs everday hourly.


------------VBSCRIPT BELOW TO CREATE JOB USING EDUARO'S
SCHEDULER --------------

set m_oSchedule = CreateObject("TaskScheduler2.Schedule")

set oTask = m_oSchedule.CreateTask("MenJob")
m_oSchedule.Refresh

With oTask

oTask.ApplicationName = "c:\test.vbs"

            ' Set other properties
            .Creator = "SS"

            ' Set default FlagsText
            .Flags = 0

            ' Add a m_oSchedule

             with .Triggers
   With .Add
   .BeginDay = DATE
     .StartTime = 0    ' not TIME - you want to run every hour from 00:00
     .Duration = 1440  ' run for 24 hours = 1 day
     .Interval = 60    ' every 60 minutes = 1 hour

  end with
      end With

            .SetAccountInfo "testuser", "testpassword"

            ' Save the task
            oTask.Save
end With

'Clean up
m_oSchedule=null
oTask =null

Author
20 Mar 2006 4:06 PM
tlviewer
"Big D" <BigDaddy@newsgroup.nospam> wrote in message
news:uVzdZtCTGHA.5808@TK2MSFTNGP12.phx.gbl...
> I have been using a task scheduler from below site. So far it's been a
great
> scheduler with all the functionality to create a windows task.
>
> http://www.mvps.org/emorcillo/en/code/vb6/index.shtml
>
> My question is how can I set the "Stop task if it runs for x number of
> hours"? By default the value is set to 72hrs. I would like to set this
value
> to 1 hr.
>

Big D,

the task object has a "maxruntime" property it defaults like this
in milli-seconds. Defaults to 72 hours : 259200000 ms

1 hour= 3600000 ( 5 zeros)

bye,
tlviewer