#!/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 = ; 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 = ; chomp($netto); print "Message? : "; $msg = ; 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__