This is just a quick (and probably pointless) script that I knocked up as an interface to NetSend on Windows NT.

In essence it's just a time trigger in which you store a message; the message being sent to the specified user at the appointed time.
This was really written as a simple introduction to perl that I could use to introduce some ideas and conventions to the "new guy" in the office.

Maybe one of you out there could take the idea and make it something a little more impressive :)

#!/usr/bin/perl # ==================================================================== +========================= # # reminder.pl # # Sends a reminder netsend to a specified user at a specified time. # my $version = "1.1"; # # Release # (1.0) - 29/5/2001 # + Version works # + Has some problems with the mins of the 24hour clock +- doesn't pad to 2 digits. # (1.1) - 30/5/2001 # + Fixed digit number problem. # + Still needs blank field checks # + Sleep time lengthened # # ==================================================================== +======================== use strict my $remindat; my $netto; my $msg; my $timenow; my ($min) = (localtime(time))[1]; $min = sprintf "%2.2d",$min; my ($hour) = (localtime(time))[2]; $hour = sprintf "%2.2d",$hour; $timenow= "$hour:$min"; print "\nTime now is $timenow\n\n"; print "Enter time to remind at ( hh:mm ) : "; $remindat = <STDIN>; chomp($remindat); $remindat =~ /(.*):(.*)/; my $remindmin = $2; $remindmin = sprintf "%2.2d",$remindmin; my $remindhour = $1; $remindhour = sprintf "%2.2d",$remindhour; $remindat = $remindhour.":".$remindmin; print "Netsend to : "; $netto = <STDIN>; chomp($netto); print "Message? : "; $msg = <STDIN>; chomp($msg); print "Will send the message to $netto at $remindat\n"; while (1) { ($min) = (localtime(time))[1]; ($hour) = (localtime(time))[2]; $timenow= "$hour:$min"; sleep(40); if ($timenow eq $remindat) { `net send $netto "$msg [ reminder.pl v$version ]"`; print "Sent\n"; exit(0); } } __END__

Replies are listed 'Best First'.
Re: Set a time triggered reminder with NetSend
by Anonymous Monk on Mar 18, 2002 at 06:54 UTC
    You forgot to format $hour and $min in the while loop.
    >8 ------------------------------------------- while (1) { $min = sprintf "%2.2d",(localtime(time))[1]; $hour = sprintf "%2.2d",(localtime(time))[2]; ------------------------------------------- 8<
    :) Sir Muskrat