[Win32utils-devel] Implementing a TaskScheduler#exists? method

Daniel Berger djberg96 at gmail.com
Wed Jun 17 00:47:52 EDT 2009



> -----Original Message-----
> From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel-
> bounces at rubyforge.org] On Behalf Of Heesob Park
> Sent: Tuesday, June 16, 2009 10:07 PM
> To: Development and ideas for win32utils projects
> Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists?
> method
> 
> 2009/6/17 Daniel Berger <djberg96 at gmail.com>:
> >
> >
> >> -----Original Message-----
> >> From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-
> devel-
> >> bounces at rubyforge.org] On Behalf Of Heesob Park
> >> Sent: Tuesday, June 16, 2009 7:47 PM
> >> To: Development and ideas for win32utils projects
> >> Subject: Re: [Win32utils-devel] Implementing a TaskScheduler#exists?
> >> method
> >>
> >> Hi,
> >>
> >> 2009/6/17 Daniel Berger <djberg96 at gmail.com>:
> >> > Hi,
> >> >
> >> > I'd like to add TaskScheduler#exists?(work_item) to the win32-
> >> taskscheduler
> >> > library. Mostly I want it for testing, but it might come in handy
> for
> >> other
> >> > people as well.
> >> >
> >> > What's the best way to approach this? Just enumerate the tasks,
> and
> >> check
> >> > for the name?
> >> >
> >> I think the best way to check taskscheduler item is just go to the
> >> Scheduled Tasks folder (in most case c:\winodws\tasks) and see the
> >> .job files.
> >>
> >> You can write it with ruby like this:
> >>
> >> def TaskScheduler#exists?(work_item)
> >>   File.exist?("#{ENV['windir']}\\Tasks\\#{work_item}.job")
> >> end
> >
> > That will work, though I don't think it's a requirement that the .job
> file
> > live there, is it?
> >
> According to http://support.microsoft.com/kb/310424/en, I think so.
> 
> >> BTW, Do you mind I write pure ruby taskscheduler?
> >
> > I don't mind so long as you're not using WMI. I never completed that
> because
> > of the restrictions.
> >
> Of course, I mean the literal translation of the current c code.
> I like to use the same technique used in pure win32ole ruby code.

I thought it would be problematic because it's C++, but if you can do it, by all means please go for it!

Regards,

Dan



More information about the win32utils-devel mailing list