Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

This is Tiglet!

by PipTigger (Hermit)
on Jul 08, 2000 at 01:45 UTC ( [id://21595]=perlcraft: print w/replies, xml ) Need Help??

   1: #!/usr/bin/perl
   2: 
   3: #yooz meee
   4: 
   5: my $fntd = `figlet -I2`;           #this is 4linux
   6: #my $fntd = "/pip/4dos/fig/fonts";  #this is 4dos
   7: 
   8:    chomp ($fntd);
   9:    $fntd .= "/*.flf";
  10: my $text = "@ARGV";
  11: my $outf = "dfaltout.txt";
  12: my @fntz = glob("$fntd");
  13: my $coun = 0;
  14: my $favs = " ";
  15: my $optn = "";
  16: my $inpt = "";
  17: 
  18: print "                       Tigger's Figlet Chooser v0.2\n";
  19: print "USAGE:  me\@myserver:\% perl tiglet.pl \"KakA NachoZ\"\n";
  20: print "Tiglet lets you interactively select the perfect figlet font \n";
  21: print " for your .sig or msg or title or... =) smiley!  \n";
  22: print "Please email suggestions or constructive criticisms to pip\@binq.org\n";
  23: print "n or Enter - checks next font, p - checks previous font\n";
  24: print "  Any specific number jumps directly to that font\n";
  25: print "t - prompts for text change, e - prompts for filename to export to\n";
  26: print "Y - SAVES selected text to specified exportfile and quits\n";
  27: print "Q - QUITS without saving, ... the parameters are not case-sensitive\n";
  28: print "Toggles: s=squish, k=kern, o=overlap, c=center, l=left, r=right, f=favorite\n";
  29: 
  30: if ($text eq "") {
  31:     $text = "KakA NachoZ";
  32:     print "Please enter text to display [$text]: ";
  33:     chomp ($poop = <STDIN>); if ($poop ne "") { $text = $poop; }
  34:     print "Please enter a file to write selected text to [$outf]: ";
  35:     chomp ($poop = <STDIN>); if ($poop ne "") { $outf = $poop; }
  36: }
  37: while ($inpt !~ /q|x|y|d/i && $coun < @fntz) {
  38:     $fntz[$coun] =~ s!.*/!!;
  39:     $kaka = `figlet -f $fntz[$coun] $optn $text`;
  40:     print "${kaka}Font\#$coun:$fntz[$coun],Text:$text,Optn:$optn,Favs:$favs,cmd[npyteskocq]: ";
  41:     chomp ($inpt = <STDIN>); $inpt =~ tr/A-Z/a-z/;
  42:     if ($inpt =~ /f/) { 
  43:         if ($favs =~ / $coun /) { $favs =~ s/ $coun / /; } 
  44: 	else { $favs .= "$coun "; } 
  45:     }
  46:     if ($inpt eq "" || $inpt =~ /n/) { $coun++;
  47:         if ($coun == @fntz) { print "Last Font Displayed!  Loop back to beginning? (y/n) ";
  48:             $poop = <STDIN>; if ($poop =~ /y/i) { $coun = 0; }
  49:         }
  50:     }
  51:     if ($inpt =~ /p/) { $coun--; }
  52:     if ($inpt =~ /\d+/) { $coun = $inpt;
  53:         if ($coun < 0) { $coun = 0; }
  54:         if ($coun > @fntz) { $coun = $#fntz; }
  55:     }
  56:     if ($inpt =~ /y/ || $inpt =~ /d/) {
  57:         print "Saving to $outf and Quitting!\n";
  58:         open OUTF, ">$outf"; print OUTF $kaka; close OUTF;
  59:     }
  60:     if ($inpt =~ /t/) { 
  61:         print "New Text [$text]: "; chomp ($poop = <STDIN>);
  62:         if ($poop ne "") { $text = $poop; }
  63:     }
  64:     if ($inpt =~ /e/) { 
  65:         print "Export File [$outf]: "; chomp ($poop = <STDIN>);
  66:         if ($poop ne "") { $outf = $poop; }
  67:     }
  68:     if ($inpt =~ /s/ || $inpt =~ /k/ || $inpt =~ /o/ ||
  69:         $inpt =~ /c/ || $inpt =~ /l/ || $inpt =~ /r/) {
  70:         if ($optn =~ /-$inpt /i) { $optn =~ s/(-$inpt |$inpt)//gi; }
  71:         else { $optn .= "-$inpt "; }
  72:     }
  73:     if ($inpt =~ /q/ || $inpt =~ /x/) { print "Quitting Without Saving!\n"; }
  74: }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-19 10:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found