--- Jim Hill [EMAIL PROTECTED] wrote:
Hi all
My mta, Mailtraq http://www.mailtraq.com/,
contains a custom
active-x control which can be accessed only when it
is running as
an application, not as a service. If Mailtraq is
started as a
service, its normal mode, the active-x control can't
be instanced
in perl or javascript ...
| test.js
| var mailtraq = new
ActiveXObject(Mailtraq.Control);
| WScript.Echo(mailtraq.Config.UserCount);
| c:\scripts cscript test.js
| Microsoft (R) Windows Script Host Version 5.6
| Copyright (C) Microsoft Corporation 1996-2001. All
rights reserved.
|
| c:\scripts\test.js(2, 1) Microsoft JScript runtime
error: Automation server can't create object
We, the Mailtraq developer and I, are assuming that
this is a
permissions problems but we can't get to the bottom
of it. If
anyone has encountered similar problems, we'd
appreciate some
pointers in the right direction.
Jim,
You can use the WinXP schtasks utility to run a script
in the SYSTEM account.
run NewJob.pl as administrator and it will create a
scheduled task that runs under the System account,
then it will run the task and show you some ENV vars
that will prove to you that it works as expected.
regards,
tlviewer
begin NewJob.pl -
#!/usr/bin/perl -w
#
# Author: [EMAIL PROTECTED]
# script: NewJob.pl
# Description: method to run a perl script in the
SYSTEM account with the WinXP schtasks utility
# keywords: schtasks backtick winxp
# Date: 03/18/06
#
use Cwd;
#
# /* part I -- get the task script from DATA and
write it to file */
#
$/ = '';
my @in = DATA;
print len=, length(join(\n,@in)), \n;
my $in = join(\n,@in);
my $task = RemotePerl;
open OUT, $task\.pl;
print OUT $in;
close OUT;
#
# /* part II -- run the utility (schtasks) using
backticks and create our _Scheduled Task_ */
#
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/schtasks.mspx?mfr=true
#
my $wd = getcwd;
print dir= $wd/$task\.pl, \n;
#exit(0);
# use the native (WinXP) utility to create Scheduled
Tasks via commandline
my $mk =NEW;
schtasks /create /tn RemotePerl /ru SYSTEM /tr perl
$wd/$task\.pl /sc once /st 09:00:00
NEW
print `$mk`;
#
# /* part III -- use backticks to run our job */
#
$mk =RUN;
schtasks /run /tn $task
RUN
print `$mk`;
sleep 2;
`notepad $wd/$task\.txt`
__END__
use File::stat;
# pretty print time
sub PPTime {
my @localtime = localtime shift;
return sprintf(%04d-%02d-%02d--%02d:%02d:%02d,
$localtime[5]+1900,
$localtime[4]+1,
$localtime[3],
$localtime[2],
$localtime[1],
$localtime[0]);
}
my $setup_path = c:\\WinNT\\setupapi.log;
my $st = stat($setup_path);
my $tstfile = $0;
$tstfile =~ s/pl\s*$/txt/i;
open OUT, $tstfile or exit(13);
print OUT Today=, PPTime( time), \n;
print OUT User=, Win32::LoginName(), \n;
print OUT mod time=, PPTime($st-mtime), \n;
#print OUT Name=, Win32::NodeName(), \n;
foreach my $var (sort keys %ENV) {
my $val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s||\\|g;
print OUT qq{${var} = ${val}\n};
}
close OUT;
exit(11);
__END__
end script --
__
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs