Southsoftware.com
   

Perl scripting in Advanced Task Scheduler

With Advanced Task Scheduler, you can run a Perl script right from a scheduled task. The script will be passed to the interpreter, and output will appear in the task's execution log when the script completes execution.

Perl Task
Click the picture to enlarge.

Getting Perl version
The script below displays current Perl version to the task execution log:

print "Version: $]";

Current task's arguments
The script below displays the %advscheduler hash variable to the task execution log:

foreach $key (keys %advscheduler) {
print $key, "=", $advscheduler{$key}, "\n";
}

Load code from external files
The script below runs Perl code from the filename.pl file:

require 'filename.pl';

Commander features
Perl script can call some Advanced Task Scheduler features via the Command line tool. The example below demonstrates how to send an e-mail message to a GMail address:

system($commander,
"--SendEMail",
"-email",
"username\@gmail.com",
"-server",
"smtp.gmail.com:587",
"-auth",
"username\@gmail.com",
"password",
"-starttls",
"-sender",
"sender\@mail.com",
"-subject",
"Subject",
"-msg",
"Text") == 0 or die "system @args failed: $?"

Where $commander is file name and path to the Command line tool: advscheduler_commander.exe, advscheduler_procmd.exe (Professional Edition) or advscheduler_netcmd.exe (Network Edition). Command line described in the Command line tool topic.

Categories: Shortcut type, Task scheduler

One response to “Perl scripting in Advanced Task Scheduler”

  1. Southsoftware says:

    If you want to run a basic Perl script, which does not require additional modules, consider this Compact Portable Perl for Windows. This is a regular Perl built from original sources and packed into a single executable file. The packed executable is a lightweight all-in-one Perl interpreter, which includes a virtual file system that works like a read-only RAM-disk. Perl includes all standard modules, excluding CPAN module, which can’t work with this portable Perl.

Leave a Reply

   
About us   Cookie policy   Privacy policy   Terms of use   Link to us