[Win32utils-devel] Can't get TaskScheduler.new to work for 0.3.0

Heesob Park phasis at gmail.com
Mon Feb 22 07:48:54 EST 2010


Hi,

2010/2/22 Daniel Berger <djberg96 at gmail.com>:
> Hi,
>
> Ruby 1.8.6 mingw
> Windows 7 Ultimate
>
> Just playing with the ole branch for win32-taskscheduler, but I can't
> get it to work. I tried this:
>
> $:.unshift 'lib'
> require 'rubygems'
> require 'win32/taskscheduler'
> include Win32
>
> task = 'test_delete_me'
>
> trigger = {
>  'start_year'   => Time.now.year + 1,
>  'start_month'  => 4,
>  'start_day'    => 1,
>  'start_hour'   => 7,
>  'start_minute' => 14,
>  'trigger_type' => TaskScheduler::DAILY,
>  'type'         => { 'days_interval' => 1 }
> }
>
> ts = TaskScheduler.new
> ts.new_work_item(@task, @trigger)
> ts.activate(@task)
>
> But that resulted in this error from RegisterTaskDefinition in new_work_item:
>
> HRESULT error code:0x80020009
>
> Any ideas?
>
You have two wrong constant definitions in taskscheduler.rb.

    TASK_UPDATE = 0x3
    TASK_CREATE_OR_UPDATE = 0x4

should be

    TASK_UPDATE = 0x4
    TASK_CREATE_OR_UPDATE = 0x6


Regards,

Park Heesob


More information about the win32utils-devel mailing list