[OS X TeX] PrettyRef

Sergei Mariev serguei.mariev at campus.lmu.de
Fri Mar 11 00:56:12 CET 2005


save the lines from "#!/usr/bin/perl"

to the last "}" as a plain text file using any application you like 
(TextWrangler, or Textedit, etc...). You can use any application for 
that. Name the file random2.pl or any other name with extension.pl 
You should save it in the path specified in the AppleScript, it 
doesn't have to be Documents/scriptsperl; (1), (2), (3) (4) are 
correct.

You can mail me directly if you have further questions! 
(serguei.mariev at campus.lmu.de)



sergei

>This install-challenged (Schremmer) couldn't wait but got almost 
>immediately stuck.
>
>Sergei Mariev wrote:
>
>>Open Script editor  in the TexShop and create the following macro:
>>
>>--AppleScript
>>do shell script "perl ~/Documents/scriptsperl/random2.pl"
>>
>>tell application "TeXShop"
>>     set the selection of the front document to (the clipboard as text)
>>end tell
>
>I did that and called it NewLabel.
>
>>Then save the following perlscript in the path specified in the 
>>macro, or adjust the path so that the shell script finds the perl 
>>script attached at the end.
>
>In Users/AlainSchremmer/Documents, I created a folder called 
>"scriptsperl" and then I got stuck: I searched for an application in 
>which to copy-paste the script and save it as "random2.pl". But, 
>while I found a perl library and other misc, no app. (I hope it is 
>not the terminal.)
>
>As for the rest, I understand that:
>(1)  the entire script is as quoted below, namely that it starts 
>with "#!/usr/bin/perl" and end with the two single "}".
>(2)  in the second line of the script,
>            open(IN, "/Users/sm/Documents/diss/random10.txt") || die 
>"Can't open random10.txt: $!\n";
>       I must replace "sm" by "AlainSchremmer".
>(3)  the file "[the script] looks for in the first place" is called 
>"random10.txt", is blank and can be created with any app that will 
>save in plain text.
>(4)  I must place "random10.txt" in a folder called "diss" which is 
>itself in Users/AlainSchremmer/Documents, that is alongside the 
>folder called scriptsperl.
>
>I will "adjust the file paths" if and when.
>
>Very grateful regards
>--schremmer
>
>>#!/usr/bin/perl
>>
>>open(IN, "/Users/sm/Documents/diss/random10.txt") || die "Can't 
>>open random10.txt: $!\n";
>>
>>@in = <IN> ;
>>$howmany = @in;
>>if ($howmany == 9999) {die "you have used all the keys\n;" }
>>
>>close IN;
>>
>>&dothejob;
>>
>>sub dothejob{
>>     $test = 0;       $rnumber = int(rand(9999));
>>     &testit;       if ($test == 1) {&dothejob;       } else 
>>{open(OUT, ">>/Users/sm/Documents/diss/random10.txt") || die "Can't 
>>open random.txt: $!\n";
>>     print OUT "$rnumber\n";
>>     $howmany++;
>>     open(PIPE, "| pbcopy");
>>     print PIPE "\\linelabel\{$rnumber\}";
>>     close PIPE;
>>     }
>>}
>>
>>sub testit{
>>     foreach $member(@in)
>>     { if ($rnumber == $member) {$test = 1;             }
>>   }
>>    }
>
>--------------------- Info ---------------------
>Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>           & FAQ: http://latex.yauh.de/faq/
>TeX FAQ: http://www.tex.ac.uk/faq
>List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>

--------------------- Info ---------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
           & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Post: <mailto:MacOSX-TeX at email.esm.psu.edu>





More information about the macostex-archives mailing list