CMD = "C:\\BIN\\PERL\\TINYPERL.EXE -I C:\BIN\PERL\LIB C:\\DESKTOP\\test.pl";
try
{
WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run(CMD, 0);
}
catch (e)
{
WScript.Echo("Error: Couldn't start Perl script.");
}
####
#!/usr/bin/perl
use strict;
use warnings;
$| = 1;
print "\x07";
##
##
#!/usr/bin/perl
use strict;
use warnings;
$| = 1;
AlertBox("Hello World!");
my $BUTTON = WinDialog("Do you want to exit now?", "My Little Perl Program", 32 + 4, 0);
if ($BUTTON == 6) { Info("You pressed YES."); EXIT(2); }
if ($BUTTON == 7) { Info("You pressed NO."); }
my ($W, $H, $D) = GetScreenResolution();
Info("Your screen resolution is $W x $H x $D\n\nGood bye now!");
EXIT(1);
####################################################################
# Displays an information dialog box
# Usage: Info(STRINGs...)
sub Info { WinDialog(join("\n", @_), "Info", 64, 0); }
####################################################################
# This function returns the resolution of the primary
# display monitor. This function works on Windows ONLY.
#
# Usage: (Width, Height, ColorDepth) = GetScreenResolution()
sub GetScreenResolution
{
if ($^O =~ m/MSWIN/i)
{
my $JSCODE = "var MSIE = WScript.CreateObject('InternetExplorer.Application');\r\nMSIE.Visible = 0;\r\nMSIE.Navigate('about:blank');\r\nMSIE.RegisterAsDropTarget = 0;\r\nMSIE.ToolBar = 0;\r\nMSIE.StatusBar = 0;\r\nMSIE.FullScreen = 0;\r\nWScript.Sleep(50);\r\nMSIE.Document.open();\r\nMSIE.Document.write(\"\\x3CSCRIPT> document.write([screen.width,screen.height,screen.colorDepth].join(',')); \\x3C/SCRIPT>