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

Discussion in 'Perl Misc' started by kpowell10, May 7, 2004.

  1. kpowell10

    kpowell10 Guest

    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
     
    kpowell10, May 7, 2004
    #1
    1. Advertising

  2. 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
     
    Mark Clements, May 7, 2004
    #2
    1. Advertising

  3. In article <409bae44$>,
    Mark Clements <> 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
     
    Richard Morse, May 7, 2004
    #3
  4. "Richard Morse" <> wrote in message
    news:...
    > 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
     
    Brian Helterline, May 7, 2004
    #4
  5. kpowell10

    Ben Morrow Guest

    Quoth (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.
    The Levellers, 'Believers'
     
    Ben Morrow, May 7, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Codemonkey
    Replies:
    8
    Views:
    9,536
  2. Replies:
    0
    Views:
    321
  3. Alan J. Flavell

    Active Perl, Windows scheduler, regular task...

    Alan J. Flavell, Sep 6, 2003, in forum: Perl Misc
    Replies:
    7
    Views:
    169
    Alan J. Flavell
    Sep 10, 2003
  4. PerlFAQ Server
    Replies:
    0
    Views:
    393
    PerlFAQ Server
    Mar 15, 2011
  5. Replies:
    10
    Views:
    231
    Thomas 'PointedEars' Lahn
    Oct 1, 2007
Loading...

Share This Page