#!/usr/bin/perl
#
# PPT-cat.pl
#
# A script to concatenate a series of single-slide PowerPoint
# presentations into a single, long PowerPoint presentation,
# usable on a headless machine

$pptmpfile="/home/ppt/tmpcat.ppt";

@slideFiles = reverse(@ARGV);

$outfile = pop(@ARGV);

$lastfile = pop(@ARGV);

system ("/bin/cp", "-f", $lastfile, $pptmpfile);

while ($#ARGV >= 0) {
  $ooarg = "macro:///Standard.PrependSlide.Main(".pop(@ARGV).")";
  print $ooarg;
  print "\n";
  system ("/usr/bin/openoffice", $ooarg);
  sleep 5;
}

system ("/bin/mv", $pptmpfile, $outfile);

#/usr/bin/openoffice 'macro:///Standard.PrependSlide.Main(/home/kris/ppt-work/test3.ppt)'
