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

K

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?
I'm getting no errors messages of any sort in the Event Viewer.
Thanks,

Kyle
 
M

Mark Clements

kpowell10 said:
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
 
R

Richard Morse

Mark Clements said:
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
 
B

Brian Helterline

Richard Morse said:
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
 
B

Ben Morrow

Quoth (e-mail address removed) (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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top