Task Scheduler with Windows OLE Excel

  • Thread starter HyRoProductions
  • Start date
H

HyRoProductions

Hi,


I got the code block in Perl below. I can run via Command and get the output result.

When I add a Task Scheduler via my Remote Desktop machine and I'm not getting any result.

I have Administrator on this system and below is my setting.


I did some search and folks said that these 2 folders need to create. I went ahead and create if it doesn't exist, it exists now but the script still doesn't output result.



C:\Windows\System32\config\systemprofile\Desktop

C:\Windows\SysWOW64\config\systemprofile\Desktop


I trigger the task manual and no result either. Any one has a solution for this?


7500a3e6-0a9e-459c-8c99-2f8b320f5b6c?upload=true.png







use strict;

use warnings;

use Win32::OLE;

use Win32::OLE qw(in with);

use Win32::OLE::Const 'Microsoft Excel';



my $rand = int(rand(1000));

my $output_file = "C:\\JSL\\test_".$rand.".xls";



my $EXCEL = Win32::OLE->new("Excel.Application","Quit");

$EXCEL->{"Visible"} = 1;

$EXCEL->{DisplayAlerts}= 0;

my $Workbook = $EXCEL -> Workbooks -> Add();

my $sheet = $Workbook -> Worksheets(1);

$sheet->Range("A1")->{Value} = $rand;

$Workbook -> SaveAs($output_file);

$Workbook -> Save();

$EXCEL->Quit();


my $jmp = Win32::OLE->new('JMP.Application');

$jmp->{'Visible'}= 1;


my $dt = $jmp->NewDataTable("test_jmp.jmp");

my $col = $dt->NewColumn("Col1", 1, 0, 8);

$dt->Save("C:\\JSL\\test.jmp");

$jmp->Quit;


Win32::OLE->FreeUnusedLibraries();

Continue reading...
 

Similar threads

Back
Top Bottom