Hi,I am trying to run a cmd file using LotusScript Shell command.
I want to send them a hotspot button on an email.
Pressing the button with the following code:
Sub Click(Source As Button)
Dim taskId As Integer
taskId% = Shell("\\Servername\sharename\Siebel\Batch files\New setup email.cmd", 1)
End Sub
Causes the batch file to run :-). But when running this way, instead of working as usual, it gets an error:
.\PERL is not recognized as an internal or external command, operable program or batch file.
Then, it copies my file OK (the second part of the job).
When I double click on the attachment, e.g. directly on the server, it works fine, why does launching from notes email cause a problem?
It also doesn’t work if I attach the file to an email and double click to launch it (and press ‘Open’ for example)…
Here’s the script:
@ECHO OFF
.\PERL .\Newsetup.pl
XCOPY “\server\share\Siebel\Misc Files\Siebel7Email.nsf” “C:\Program Files\Lotus\Notes\data” /y /i /s
PAUSE
EXIT
And here’s the PERL:
#!/usr/bin/perl
my $backup = “”;
my $notesini = “”;
my $return_code = 0;
sub backup_filename {
my $exit = 1;
my $filename = "$_[0].backup";
my $loop = 1;
if (-e "$filename") {
while ($exit == 1) {
if (-e "$filename.$loop") {
$loop++;
} else {
$filename = "$filename.$loop";
$exit = 0;
}
}
}
return $filename;
}
sub create_notesini {
my ($original, $new) = @_;
my $found = 0;
open(IN, $original);
open(OUT, ">$new") || die "Error unable to create new notes.ini!!!";
while(<IN>) {
if ( /SIEBELFORMPATH=.*SiebelEmail.nsf/ ) {
s/SiebelEmail.nsf/Siebel7Email.nsf/g;
$found = 1;
} elsif ( /SIEBELFORMPATH=Siebel7Email.nsf/ ) {
$found = 1;
}
print OUT $_;
}
close(IN);
if ( !$found ) {
print OUT "SIEBELFORMPATH=Siebel7Email.nsf\n";
}
close(OUT);
}
if (-e “C:\Lotus\Notes\notes.ini”) {
$notesini = "C:\\Lotus\\Notes\\notes.ini"
} elsif (-e “C:\Program Files\Lotus\Notes\notes.ini”) {
$notesini = "C:\\Program Files\\Lotus\\Notes\\notes.ini";
} else {
print "Error can't find Lotus Notes you may need to edit the file manually!\n";
exit -1;
}
print “notes.ini is : $notesini\n”;
$backup = backup_filename($notesini);
@args = (“move”, “$notesini”, “$backup”);
$return_code = system(@args);
if ($return_code != 0) {
print "Error creating backup file!!!\n";
print "Error code returned was: " . $return_code . "\n";
exit -1;
}
create_notesini($backup, $notesini);
$datadir = substr($notesini, 0, (length($notesini) - 10));