$window->document->write("
Hi.
");
$window->document->write("Here is a try using a PerlScript.
");
sub PrintWelcome {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime();
$thisday=(Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday)[$wday];
$thismon=(January,February,March,April,May,June,July,August,September,October,November,December)[$mon];
if ($hour < 12) {
$window->document->write( "Good morning! ");
} elsif ($hour < 17) {
$window->document->write( "Good afternoon! ");
} else {
$window->document->write( "Good evening! ");
};
$ampm = 'AM';
if ($hour > 12) {
$hour-=12;
$ampm = 'PM';
}
$time = sprintf '%d:%2.2d:%2.2d',$hour,$min,$sec;
$year += 1900;
$datetime = $time.' '.$ampm.', '.$thisday.', '.$thismon.' '.$mday.', '.$year;
$window->document->write("Just in case you were wondering, it's
");
$window->document->write($datetime);
$window->document->write("
Your username is $ENV{'USERNAME'} (it\'s in \$ENV{'USERNAME'}), the computername is $ENV{'COMPUTERNAME'} (it\'s in \$ENV{'COMPUTERNAME'}), and your OS is $ENV{'OS'} (it\'s in \$ENV{'OS'}).
");
$window->document->write("
Here is everything in %ENV:
");
foreach $key (sort(keys %ENV)) {
$window->document->write("
$key" . " = " . $ENV{$key} . "
");
}
my @rec = `ipconfig /all`;
# print "@rec\n"; # to print out all of the command's output
my $itemmac;
foreach $itemmac (@rec){
#chomp $itemmac};
# to split line 12 of the above, up into fileds/one-words
#my ($field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field9, $field10, $field11, $field12, $mac) = split(/\s+/, $rec[13]);
#print "Your MAC(Media Access Control)/Physical Address in hexadecimal is: $mac\nThe first three bytes (e.g., 00-0A-CC) are the manufacturer's code and can be used to identify the manufacturer.\nThe last three are the unique station ID or serial number for the interface.\n";
$window->document->write("
Your MAC(Media Access Control)/Physical Address in hexadecimal is: $itemmac
");
};
}
PrintWelcome();