Win32 taskscheduler setup

Is there a way to specify multiple schedules when setting up a task?

I'd like to do something such as this:

"trigger_type" => TaskScheduler::ON_IDLE & AT_LOGON

Also, I just heard that a Ruby Win32 is underway. That's going to be very nice. Looking forward to buying a copy!

rtilley wrote:

Also, I just heard that a Ruby Win32 is underway. That's going to be very nice. Looking forward to buying a copy!

Ruby Win32 _book_ that is!

Hi,

From: rtilley <rtilley@vt.edu>
Reply-To: ruby-talk@ruby-lang.org
To: ruby-talk@ruby-lang.org (ruby-talk ML)
Subject: win32 taskscheduler setup
Date: Tue, 28 Mar 2006 10:43:55 +0900

Is there a way to specify multiple schedules when setting up a task?

I'd like to do something such as this:

"trigger_type" => TaskScheduler::ON_IDLE & AT_LOGON

Also, I just heard that a Ruby Win32 is underway. That's going to be very nice. Looking forward to buying a copy!

You can add multiple triggers like this:

trigger1 = {
  "start_year" => 1,
  "start_month" => 1,
  "start_day" => 1,
  "trigger_type" => TaskScheduler::ON_IDLE
}
trigger2 = {
  "start_year" => 1,
  "start_month" => 1,
  "start_day" => 1,
  "trigger_type" => TaskScheduler::AT_LOGON
}

ts = TaskScheduler.new
ts.new_work_item("foo",nil)
ts.application_name = "notepad.exe"
ts.trigger=trigger1
ts.trigger=trigger2
ts.save

A little weird, but it works for the current version.

Regards,

Park Heesob