Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

St. Valentine's Day preperation script

by silent11 (Vicar)
on Jan 27, 2003 at 22:32 UTC ( [id://230380]=poem: print w/replies, xml ) Need Help??

St. Valentine's day is approaching. You may not be thinking about it, but she is. Don't be unprepared! Warm her up before the chocolates and roses arrive. Let her know that you love her all year long, not just Feb 14th. Just insert your own love lines and sweet words into this script and when ever you need more points with her, just "double click" and send you love.

#!/usr/bin/perl # just put this bad boy on your desktop and # double click as needed. :) use strict; use Mail::Sendmail; # you my $self = 'Monk'; my $email = 'me@workplace.com'; # her my $chicks_name = 'Chick'; my $her_email = 'chick@mail.com'; my @cheese = ( "hey $chicks_name\n\n I hope everythings going well today.\n I just wa +nted to drop you a line.\n\nLove always,\n\t$self", "Baby,\n I just wanted you to know how much I love you. Youre great!\n +\nLove,\n\t$self", "I've been thinking about you all day. I can't wait to come home to yo +u.\n talk to ya later,\n\t$self", ); my @subjects = ( "hey babe...", "a short message from your lover...", "just wanted to say hi...", "oh I love you...", ); my %mail = ( To => $her_email, From => $email, Subject => $subjects[rand($#subjects)], Message => $cheese[rand($#cheese)] ); sendmail(%mail) || warn "$!";

Good luck! This code has been tested, but is still untested.... use at your own risk :)

-Silent11

Replies are listed 'Best First'.
Re: St. Valentine's Day preperation script
by selena (Acolyte) on Jan 28, 2003 at 18:02 UTC
    This is nice - but wouldn't it be better to personalize it more? You could take phrases from previous loving emails exchanged by the couple.. or phrases from love letters from others.. or just quote Smoove B.
    #! /usr/bin/perl -w use LWP::UserAgent; use Carp; use Mail::Sendmail; use strict; my $mood = shift || 'smoove'; # you my $self = 'Monk'; my $email = 'monk@monastery'; # her my $chicks_name = 'Chick'; my $her_email = 'chick@hermail.com'; my @subjects = ( "hey babe...", "a short message from your lover...", "just wanted to say hi...", "oh I love you...", ); my $ua = LWP::UserAgent->new(); $ua->agent("MySmooveB/0.1 "); my @doghouse = ( 'http://www.theonion.com/onion3120/pick_up_phone_3120 +.html', 'http://www.theonion.com/onion3107/baby_please_3107.h +tml', 'http://www.theonion.com/onion3402/he_is_no_good_3402 +.html'); my @smoove = ( 'http://www.theonion.com/onion3102/treat_u_right_3102.h +tml', 'http://www.theonion.com/onion3114/think_of_you_3114.ht +ml', 'http://www.theonion.com/onion3202/bringiton.html', 'http://www.theonion.com/onion3213/let_us_freak_3213.ht +ml', 'http://www.theonion.com/onion3313/get_smooved_3313.htm +l' ); my @text; if ($mood =~ /d/) { # you're in the doghouse foreach my $x (@doghouse) { my $req = HTTP::Request->new(GET => "$x"); my $retval = $ua->request($req)->as_string; push (@text, split(/\<p\>/, $retval)); } } else { # default, is smoove foreach my $x (@smoove) { my $req = HTTP::Request->new(GET => "$x"); my $retval = $ua->request($req)->as_string; push (@text, split(/\<p\>/, $retval)); } } my @smoove_text; foreach my $t (@text) { next if ($t =~ m/(img src|script|\{|\})/); next if ($t eq ""); $t =~ s/\&quot\;/ /g; $t =~ s/\<(\/)?i\>/ /g; $t =~ s/\&(\S*)\;//g; $t =~ s/\<\/p\>//g; $t =~ s/\//\n/g; $t =~ s/\./\.\n/g; $t =~ s/Smoove B/$self/g; my @lines = split(/\n/, $t); foreach my $l (@lines) { $l =~ s/^\s*//; next if ($l eq "."); next if ($l eq ""); push (@smoove_text, $l); } } my %mail = ( To => $her_email, From => $email, Subject => $subjects[rand($#subjects)], Message => $smoove_text[rand($#smoove_text)] ); sendmail(%mail) || warn "$!";
    Sure, its extra effort. But no effort is too much for my baby. Smoove out.
      Oh dear, that is absolutely the most beautiful use of perl I have ever seen. Baby.
Re: St. Valentine's Day preperation script
by Wysardry (Pilgrim) on Jan 28, 2003 at 01:35 UTC

    Hey, where's the option for randomizing which "chick" it gets sent to? I mean, if you need to automate this, it must be because there's more than one, right? :D

    __________
    "Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to one instruction which doesn't work." -- (Author Unknown)

Re: St. Valentine's Day preperation script
by LAI (Hermit) on Jan 27, 2003 at 22:56 UTC

    ++silent11
    Very enjoyable. For a lot of people Perl is a tool to automate tedious maintenance tasks, and your script is a perfect example of this. Thank you for this useful contribution to the community!

    I would write this into a cron job, but the regularity of it might raise suspicions (an email received every Tuesday and Friday at 3:14 PM... hmm...). I wonder if I could somehow randomize the time of the cron. Or maybe code a daemon in Perl that would pick a time randomly within a certain range.

    OOH! And to make sure it doesn't get sent while I'm home sick or whatever, I can have it system("w | grep 'LAI'") to make sure I'm logged in! Oh, the possibilities...


    LAI
    :eof
      I wonder if I could somehow randomize the time of the cron.

      Don't bother. Just run it from cron every ten minutes or so (during likely hours of course) and send the message if rand 100 > 98 or something.

      -sauoq
      "My two cents aren't worth a dime.";
      
Re: (nrd) St. Valentine's Day preperation script
by newrisedesigns (Curate) on Jan 28, 2003 at 13:51 UTC

    Using batkins' pearl of wisdom...

    #tested - works for me (win2k) use Win32::OLE qw( EVENTS ); my $lovespeak = new Win32::OLE( "{EEE78591-FE22-11D0-8BEF-0060081841DE +}" ) or die "$!"; my $self = 'Monk'; # you my $chicks_name = 'Chick'; # her my @cheese = ( "hey $chicks_name\n\n I hope everythings going well today.\n I just wa +nted to drop you a line.\n\nLove always,\n\t$self", "Baby,\n I just w +anted you to know how much I love you. Youre great!\n\nLove,\n\t$self +", "I've been thinking about you all day. I can't wait to come home t +o you.\n talk to ya later,\n\t$self", ); my @subjects = ( "hey babe...", "just wanted to say hi...", "oh I love you...", ); my $random = int(rand($#subjects)); my $say = $subjects[$random]; $random = int(rand($#cheese)); $say .= $cheese[$random]; $lovespeak->Speak($say); while( $lovespeak->{Speaking} ){ Win32::OLE->SpinMessageLoop(); Win32::Sleep( 100 ); }

    Nothing says "I wuv you" like a robotic voice!

    "What is this emotion you call 'wuv'?"
    "Surely you mean, 'love'?"
    "No, 'wuv', with an Earth double-u."
    "This confuses and enrages us!"
    -Futurama

    Happy St. Valentine's Day.

    Update: removed the "+ 1" from the int rand.

    John J Reiser
    newrisedesigns.com

      Hey is there a way i can use that on win98se computers? I dunno if it's my compiler, or what..

        I guess you do not have the "DirectSpeechSynthesis Module" (%Systemroot%\speech\XVoice.dll) on the win98se. GOK if you can install that there and what is that part of. (Search for that {EEE785...} in your registry).

        Jenda

Re: St. Valentine's Day preperation script
by Mr. Muskrat (Canon) on Jan 28, 2003 at 14:39 UTC

    I made a few changes:
    1) it now works on my win98 system (no mail server at localhost)
    2) To and From now include the people's names
    3) fixed a typo

    #!/usr/bin/perl # just put this bad boy on your desktop and # double click as needed. :) use strict; use Mail::Sendmail; # you my $self = 'Monk'; my $email = 'me@workplace.com'; # her my $chicks_name = 'Chick'; my $her_email = 'chick@mail.com'; my @cheese = ( "hey $chicks_name\n\n I hope everythings going well today.\n I just wa +nted to drop you a line.\n\nLove always,\n\t$self", "Baby,\n I just wanted you to know how much I love you. You're great!\ +n\nLove,\n\t$self", "I've been thinking about you all day. I can't wait to come home to yo +u.\n talk to ya later,\n\t$self", ); my @subjects = ( "hey babe...", "a short message from your lover...", "just wanted to say hi...", "oh I love you...", ); my %mail = ( To => "$chicks_name<$her_email>", From => "$self<$email>", smtp => 'mail.your.isp', Subject => $subjects[rand($#subjects)], Message => $cheese[rand($#cheese)] ); # $Mail::Sendmail::error gives details as to what went wrong sendmail(%mail) or die $Mail::Sendmail::error;
Re: St. Valentine's Day preperation script
by frankus (Priest) on Feb 05, 2003 at 10:58 UTC
    Call me a lego coder but surely:
    perl -MBone::Easy -le'print pickup()."\n\n--frankus"' | mail grace.hop +per@navy.mil
    does the same thing? Well... kinda ;^)

    --

    Brother Frankus.

Re: St. Valentine's Day preperation script
by Ananda (Pilgrim) on Feb 08, 2003 at 05:59 UTC
    Excellant!!

    Ananda

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: poem [id://230380]
Approved by Mr. Muskrat
Front-paged by newrisedesigns
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found