All pastes #284076 Raw Edit

Stuff

public text v1 · immutable
#284076 ·published 2006-12-18 21:06 UTC
rendered paste body
#!/usr/bin/perl

#This program gives the user an option of choosing the text that is available to his or her Clipbrd
#It Reads from a text file, To get a new line of text from your text file Simply
#try to copy and paste something new, each time you copy, a new line is inserted from the text file to your Clipbrd.
#each new line in the text file is a line that can be sent to clipbrd
#The Current Application of this is pickup lines, but it could be expanded to everyday lingo.
#lines are selected at random.


# To Compile this script you need the following Modules
use strict;
use warnings;
use Win32::Clipboard;
use Win32::GUI();


my $dos = Win32::GUI::GetPerlWindow();
my $clip = Win32::Clipboard();


print "+++++++++++++++++++++++++++++++\n";
print "+                             +\n";
print "+     Coded by: Conundrum     +\n";
print "+    (with a bit of help)     +\n";
print "+    *Shoutz To #purgat0ry*   +\n";
print "+                             +\n";
print "+++++++++++++++++++++++++++++++\n";

one:
print "Filename: ";
chomp(my $filename = <STDIN>);
my @quotes;
open FILE, '<', $filename;
if(! -e FILE){
  print ":: $filename does not exist.\n:: Please enter correct filename.\n";
  goto one;
}
else{
  while(<FILE>){
    chomp;
    push(@quotes, $_);
  }
  print $quotes[int(rand(scalar(@quotes)))] . "\n";
}
Win32::GUI::Hide($dos);
for(;;){
 $clip -> Set("$quotes[int(rand(scalar(@quotes)))]");
 $clip -> WaitForChange();
};