Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Perl script runs from command prompt but not from Task Scheduler in Win2000 (http://www.velocityreviews.com/forums/t886361-perl-script-runs-from-command-prompt-but-not-from-task-scheduler-in-win2000.html)

kpowell10 05-07-2004 03:39 PM

Perl script runs from command prompt but not from Task Scheduler in Win2000
 
Hi all,

I have a script that runs fine from the command prompt, but that fails
when I run it from Task Scheduler.

Apparently the line that is failing is an OLE module command:
$xlworkbook = $xl_app->Workbooks->Add;

Any ideas what might cause this behavior or how to pin down the cause?
I'm getting no errors messages of any sort in the Event Viewer.
Thanks,

Kyle

Mark Clements 05-07-2004 03:42 PM

Re: Perl script runs from command prompt but not from Task Schedulerin Win2000
 
kpowell10 wrote:

> I have a script that runs fine from the command prompt, but that fails
> when I run it from Task Scheduler.
>
> Apparently the line that is failing is an OLE module command:
> $xlworkbook = $xl_app->Workbooks->Add;
>
> Any ideas what might cause this behavior or how to pin down the cause?
> I'm getting no errors messages of any sort in the Event Viewer.


what happens if you wrap it in an eval {} and dump $@ somewhere?

Mark

Richard Morse 05-07-2004 04:10 PM

Re: Perl script runs from command prompt but not from Task Scheduler in Win2000
 
In article <409bae44$1@news.kcl.ac.uk>,
Mark Clements <mark.clements@kcl.ac.uk> wrote:

> kpowell10 wrote:
>
> > I have a script that runs fine from the command prompt, but that fails
> > when I run it from Task Scheduler.
> >
> > Apparently the line that is failing is an OLE module command:
> > $xlworkbook = $xl_app->Workbooks->Add;
> >
> > Any ideas what might cause this behavior or how to pin down the cause?
> > I'm getting no errors messages of any sort in the Event Viewer.

>
> what happens if you wrap it in an eval {} and dump $@ somewhere?


Or put a line like the following at the start of the script:

open(STDERR, ">>", "c:/temp/odd_errors")
or die("can't change STDERR: $!"); # yes, I see the problem
open(STDOUT, ">>", "c:/temp/odd_output")
or die("can't change STDOUT: $!");

warn (('-' x 5) . ' ' . scalar(localtime) . "\n");

....


HTH,
Ricky

--
Pukku

Brian Helterline 05-07-2004 07:54 PM

Re: Perl script runs from command prompt but not from Task Scheduler in Win2000
 
"Richard Morse" <remorse@partners.org> wrote in message
news:remorse-D63F92.12101007052004@plato.harvard.edu...
> Or put a line like the following at the start of the script:
>
> open(STDERR, ">>", "c:/temp/odd_errors")
> or die("can't change STDERR: $!"); # yes, I see the problem
> open(STDOUT, ">>", "c:/temp/odd_output")
> or die("can't change STDOUT: $!");


or better yet, put it in a BEGIN block to catch compile time info



Ben Morrow 05-07-2004 10:44 PM

Re: Perl script runs from command prompt but not from Task Scheduler in Win2000
 

Quoth kpowell10@hotmail.com (kpowell10):
> Hi all,
>
> I have a script that runs fine from the command prompt, but that fails
> when I run it from Task Scheduler.
>
> Apparently the line that is failing is an OLE module command:
> $xlworkbook = $xl_app->Workbooks->Add;
>
> Any ideas what might cause this behavior or how to pin down the cause?


You probably don't have Excel running when the task is scheduled. IIRC
there is an OLE call that will create a new instance of
Excel.Application, or return a running one if there is one...?

Ben

--
If you put all the prophets, | You'd have so much more reason
Mystics and saints | Than ever was born
In one room together, | Out of all of the conflicts of time.
ben@morrow.me.uk The Levellers, 'Believers'


All times are GMT. The time now is 02:22 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57