Loading ...
Sorry, an error occurred while loading the content.

Please Some Modify this Script

Expand Messages
  • Shahzad
    Hi All I want help in making a Script i have attached a perl Script with me mail. any person who knows Perl and POSTScript Module then please help me this
    Message 1 of 1 , Sep 25, 2002
    • 0 Attachment
      Hi All

      I want help in making a Script i have attached a perl Script with me mail. any person who knows Perl and POSTScript Module then please help me this Script actually READS the WORDS.DAT file which contains the words and makes a PostScript File which has 6 portions containing 4 Words on the Front and Meaning at Back .... this script helps making Flash Cards...

      so any one please Modify this script so that one flash card contain only 1 word and its meaning on its back and 1 page contain more than 6 cards..
      and script should be able to read all of the Words.DAT File..

      format of Words.DAT

      Word
      Meaning
      Sentence

      .....................

      ...

      Waiting for Modified Script.........



      ////////////////////////////////////////////////////////////////////////////////////////////////////////////
      use PostScript::TextBlock;

      $sosw = "";
      $sosm = "";

      $lines = "4 setlinewidth 0 0 0 setrgbcolor\n".
      "newpath 294 1 moveto 294 842 lineto stroke 4 setlinewidth\n".
      "newpath 1 280 moveto 594 280 lineto stroke 4 setlinewidth\n".
      "newpath 1 560 moveto 594 560 lineto stroke\n";

      sub oneword {

      %W_written = ();

      $W_ret = open W_WRITTEN,"<.written";

      if($W_ret) {
      while() {
      $W_written{$_} = 1;
      }
      close W_WRITTEN;
      }

      open W_IN,"
      while() {
      $W_mm = ;
      $W_ee = ;
      chomp $_;chomp $W_mm;chomp $W_ee;
      $W_m{$_} = $W_mm;
      $W_e{$_} = $W_ee;
      }

      close W_IN;

      @W_all = keys %W_m;

      $W_numwords = $#W_all;

      while(1) {
      $W_whichword = 1 + int(1 + rand $W_numwords) % $W_numwords;
      if(exists $W_written{$W_all[$W_whichword]}) {next;}
      else {last;}
      }

      open W_WRITTEN,">>.written";
      print W_WRITTEN "$W_all[$W_whichword]\n";
      close W_WRITTEN;

      $W_return = "$W_all[$W_whichword] | ". $W_m{$W_all[$W_whichword]}." | ". $W_e{$W_all[$W_whichword]};

      return $W_return;
      }

      sub oneblock {
      my $words = "";
      my $meanings = "";

      my $output = oneword();

      my @l = split('\|',$output);

      $sosw = "";
      $sosw .= $l[0];
      $sosw .= "\n";

      $sosm = "";
      $sosm .= $l[1];
      $sosm .= "=> ";
      $sosm .= $l[2];
      $sosm .= "\n";
      }

      $totalw = "";
      $totalm = "";

      sub block {
      $totalw = "";
      $totalm = "";
      for($i = 1;$i <=4;$i++) {
      oneblock();
      $totalw .= " $i . $sosw";
      $totalm .= "$i . $sosm";
      }
      }

      block();
      my $t00 = $totalw;
      my $m01 = $totalm;

      block();
      my $t01 = $totalw;
      my $m00 = $totalm;

      block();
      my $t10 = $totalw;
      my $m11 = $totalm;

      block();
      my $t11 = $totalw;
      my $m10 = $totalm;

      block();
      my $t20 = $totalw;
      my $m21 = $totalm;

      block();
      my $t21 = $totalw;
      my $m20 = $totalm;


      my $tb = new PostScript::TextBlock;
      my $code,$remainder;

      open OUT1, '>psoutput1.ps';
      print OUT1 "%!PS-Adobe-3.0\n".
      "%%Creator: The Perl PostScript Package\n".
      "%%Pages: (atend)\n".
      "%%BoundingBox: 0 0 595 842\n".
      "%%EndComments\n".
      "%%BeginProlog\n".
      "%%EndProlog\n".
      "%%Page: 1 1\n";


      $tb->addText(
      text => $t00,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 15, 838);
      print OUT1 $code;

      $tb->addText(
      text => $t01,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 297, 838);
      print OUT1 $code;

      $tb->addText(
      text => $t10,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 15, 560);
      print OUT1 $code;

      $tb->addText(
      text => $t11,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 297, 560);
      print OUT1 $code;

      $tb->addText(
      text => $t20,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 15, 280);
      print OUT1 $code;

      $tb->addText(
      text => $t21,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 297, 280);
      print OUT1 $code;

      print OUT1 "$lines showpage\n".
      "%%EndPage: 1 1\n".
      "%%Page: 2 2\n";

      $tb->addText(
      text => $m00,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 15, 838);
      print OUT1 $code;

      $tb->addText(
      text => $m01,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 297, 838);
      print OUT1 $code;

      $tb->addText(
      text => $m10,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 15, 560);
      print OUT1 $code;

      $tb->addText(
      text => $m11,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 297, 560);
      print OUT1 $code;

      $tb->addText(
      text => $m20,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 15, 280);
      print OUT1 $code;

      $tb->addText(
      text => $m21,
      font => 'CenturySchL-Ital',
      size => 10,
      leading => 0
      );

      ($code, $remainder) = $tb->Write(272, 265, 297, 280);
      print OUT1 $code;

      print OUT1 "$lines showpage\n".
      "%%EndPage: 2 2\n";
      close OUT1;
      ///////////////////////////////////////////////////////////////////////////////////////////////////////


      ---------------------------------
      Do you Yahoo!?
      New DSL Internet Access from SBC & Yahoo!

      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.