#!/usr/bin/perl
use English;
use Time::Local 'timelocal_nocheck','timelocal';
use Time::localtime;

$outpath='"/c/Documents and Settings/Rob/My Documents/aaprint/';

@date_parse=localtime(time());
$sec=${date_parse[0]}[0];
$min=${date_parse[0]}[1];
$hour=${date_parse[0]}[2];
$mday=${date_parse[0]}[3];
$mon=${date_parse[0]}[4];
$year=${date_parse[0]}[5];

$datestr=sprintf("%s%02d%02d%02d_%02d%02d%02d", $outpath,$year%100, $mon+1, $mday, $hour, $min, $sec);

$of=$datestr.".pdf\"";
$i=0;
while (-e $of) {
  $i++;
  $of=$datestr."_$i.pdf\"";
}
$cmd="ps2pdf - $of";
print $cmd;
exec $cmd;
# exec @l;
# print "\nlist=@l\n";

