Daniel Berger
2010-Feb-22 03:08 UTC
[Win32utils-devel] Can''t get TaskScheduler.new to work for 0.3.0
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? Thanks, Dan
Heesob Park
2010-Feb-22 03:18 UTC
[Win32utils-devel] Can''t get TaskScheduler.new to work for 0.3.0
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. Refer to http://rubyforge.org/pipermail/win32utils-devel/2009-June/001438.html Regards, Park Heesob
Daniel Berger
2010-Feb-22 04:24 UTC
[Win32utils-devel] Can''t get TaskScheduler.new to work for 0.3.0
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. Regards, Dan
Daniel Berger
2010-Feb-22 05:16 UTC
[Win32utils-devel] Can''t get TaskScheduler.new to work for 0.3.0
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
Heesob Park
2010-Feb-22 06:45 UTC
[Win32utils-devel] Can''t get TaskScheduler.new to work for 0.3.0
Hi, 2010/2/22 Daniel Berger <djberg96 at gmail.com>:> 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. >Sorry, I fogot I made the taskscheduler version 2.0 implementation :) It should work for vista and windows 7. I''ll look into the source code. Regards, Park Heesob
Heesob Park
2010-Feb-22 12:48 UTC
[Win32utils-devel] Can''t get TaskScheduler.new to work for 0.3.0
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
Daniel Berger
2010-Feb-23 01:55 UTC
[Win32utils-devel] Can''t get TaskScheduler.new to work for 0.3.0
Heesob Park 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? >> > 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 = 0x6Oy, thanks. Dan
Heesob Park
2010-Feb-23 02:51 UTC
[Win32utils-devel] Can''t get TaskScheduler.new to work for 0.3.0
Hi, As you know, 0.3.0 is not working on XP and 0.2.x is not working on Vista and laster. For now, we have 0.2.x for XP, 2K and 2003 and 0.3.x for Vista, 2008 and 7. What''s your release plan of win32-taskscheduler? Any idea of the unified version? Regards, Park Heesob
Daniel Berger
2010-Feb-23 02:53 UTC
[Win32utils-devel] Can''t get TaskScheduler.new to work for 0.3.0
Heesob Park wrote:> Hi, > > As you know, 0.3.0 is not working on XP and 0.2.x is not working on > Vista and laster. > > For now, we have 0.2.x for XP, 2K and 2003 and 0.3.x for Vista, 2008 and 7. > > What''s your release plan of win32-taskscheduler? > > Any idea of the unified version?I was thinking about that last night. My initial idea is to ship 3 files: taskscheduler.rb taskscheduler1.rb taskscheduler2.rb taskscheduler1.rb would be the current 0.2.0 branch. taskscheduler2.rb would be the new code. taskscheduler.rb would then require taskscheduler1.rb or taskscheduler2.rb based on the current version of windows. I have some helper functions in windows-pr for that. Does that seem reasonable? Regards, Dan