survivor83 has asked for the wisdom of the Perl Monks concerning the following question:
First of all, I must say that I am new to the idea of programming in Perl.
I have written the program shown below which tries to call Win32::TaskScheduler in order to schedule a specific task:
use Win32::TaskScheduler;<br> sub create_schedule($$$$$$$$$$$)<br> <br> { <br> my ($mins, $hrs, $mon,$tue,$wed,$thu,$fri, <br> $sat,$sun,$target_machine,$task_name) = @_; <br> my $days;<br> print my $scheduler = Win32::TaskScheduler->New();<br> my %trig=(<br> 'BeginYear' => 2005,<br> 'BeginMonth' => 03,<br> 'BeginDay' => 20,<br> 'StartHour' => $hrs,<br> 'StartMinute' => $mins,<br> 'TriggerType' => $scheduler -> <br> TASK_TIME_TRIGGER_MONTHLYDOW,<br> 'Type'=>{<br> 'WhichWeek' => <br> $scheduler->TASK_FIRST_WEEK | $scheduler->TASK_SECOND_WEEK <br> | $scheduler->TASK_THIRD_WEEK | $scheduler->T +ASK_LAST_WEEK, 'DaysOfTheWeek' => <br> $scheduler->TASK_TUESDAY,<br> 'Months' => $scheduler->TASK_JANUARY | $scheduler->TASK_FEBRUARY <br> |$scheduler->TASK_MARCH |<br> $scheduler->TASK_APRIL | $scheduler->TASK_MAY | <br> $scheduler->TASK_JUNE | $scheduler->TASK_JULY |$scheduler->TASK_AUGUST | <br> $scheduler->TASK_SEPTEMBER | <br> $scheduler->TASK_OCTOBER | $scheduler->TASK_NOVEMBER | <br> $scheduler->TASK_DECEMBER<br> },<br> );<br> print $scheduler->SetTargetComputer("\\\\MYHOST");<br> my $tsk = $task_name;<br> my $k;<br> foreach $k (keys %trig)<br> { <br> print "$k=" . $trig{$k} . "\n";<br> } print $scheduler->NewWorkItem($tsk,\%trig); <br> print $scheduler->SetApplicationName <br> ("timezone.pm");<br> print $scheduler->Save(); <br> $scheduler = Win32::TaskScheduler->New();<br> $scheduler->Activate($task_name); <br> }
I suspect that this has to do something with the NewWorkItem function of Win32:: TaskScheduler; however the 'trig' array does not seem to have any null pointers. Also the 'timezone.pm' file is in the same folder with the code shown above.I have searched for extra documentation on CPAN and google concerning this function, but it did not help. I would be very grateful to anyone who could tell what the reason of this problem could be.
Thank you in advance,
Harry
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::TaskScheduler error
by BrowserUk (Patriarch) on Mar 16, 2005 at 02:03 UTC |