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

Daniel Berger djberg96 at gmail.com
Mon Feb 22 00:16:21 EST 2010


On Sun, Feb 21, 2010 at 9:24 PM, Daniel Berger <djberg96 at gmail.com> wrote:
> On Sun, Feb 21, 2010 at 8:18 PM, Heesob Park <phasis at gmail.com> wrote:
>> 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?
>>>
>> As I mentioned before, the current taskscheduler implementation is not
>> compatible with Vista and Windows 7.
>
> Oh, I thought you were only referring to the 0.2.0 version, not the ole branch.

Actually, after looking at
http://www.microsoft.com/technet/scriptcenter/topics/vista/tasks2.mspx,
it sure looks like that code should work. I converted that script to
use Ruby's win32ole and it worked just fine.

git clone git at github.com:djberg96/win32-taskscheduler.git
git checkout -b ole origin/ole

I'll play with it some more later.

Regards,

Dan


More information about the win32utils-devel mailing list