Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Using Perl to create a PowerPoint presentation

by watcher@LBK (Initiate)
on Oct 01, 2005 at 17:07 UTC ( [id://496659]=perlquestion: print w/replies, xml ) Need Help??

watcher@LBK has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks, I have a question for thee! For a little projec I'm involved, I need to build some sort of slideshow (preferably a PowerPoint presentation) which on each slide a picture (resizzed and all) and a little text (one line max). As I have not much experience with Perl (I can make a lot of simple things, but this is a bit complex) any suggestions are welcome as long as it does what I need and it can run on a windows laptop (so PPT is not necessary, but needs to work on a windows puter). I thank thee and I hope for a quick reply to my question!

2005-10-02 Retitled by holli, as per Monastery guidelines
Original title: 'Making slideshow for MS'

  • Comment on Using Perl to create a PowerPoint presentation

Replies are listed 'Best First'.
Re: Using Perl to create a PowerPoint presentation
by pg (Canon) on Oct 01, 2005 at 18:41 UTC

    60 lines of Perl code, but I don't have the text portion, so it is now the time for you to modify it:

    use Tk; use Tk::JPEG; use File::Glob ':glob'; my $automode = 0; my @jpgs = bsd_glob("9???.jpg"); my $index = -1; my $mw = MainWindow->new(title => "JPEG"); $mw->geometry("800x800"); my $f = $mw->Frame()->pack(-fill => "both"); $f->Button(-text => "Load", -command => \&load)->pack(-side => "left", + -fill => "both"); my $pattern = $f->Entry(-width => 10, -text => '*')->pack(-side => "le +ft", -fill => "both"); my $step; $f->Button(-text => "<<", -command => sub {prev_image($step->get())})- +>pack(-side => "left", -fill => "both"); $f->Button(-text => "<", -command => sub {prev_image(0)})->pack(-side +=> "left", -fill => "both"); $step = $f->Entry(-width => 3, -text => 10)->pack(-side => "left", -fi +ll => "both"); $f->Button(-text => ">", -command => sub {next_image(0)})->pack(-side +=> "left", -fill => "both"); $f->Button(-text => ">>", -command => sub {next_image($step->get())})- +>pack(-side => "left", -fill => "both"); $f->Checkbutton(-text => "Auto Mode", -onvalue => 1, -offvalue => 0, - +variable => \$automode, -command => sub {if ($automode) {print $autom +ode; next_image()}})->pack(-side => "left", -fill => "both"); $f->Label(-text => "Delay")->pack(-side => "left", -fill => "both"); my $delay = $f->Entry(-width => 4, -text => 1000)->pack(-side => "left +", -fill => "both"); $f->Label(-text => "milli-second(s)")->pack(-side => "left", -fill => +"both"); my $image = $mw->Photo(); next_image(0); my $button = $mw->Label(-image => $image)->pack(-side => "top", -fill +=> "both"); MainLoop; sub load { @jpgs = bsd_glob($pattern->get()); $index = -1; next_image(0); } sub next_image { $index += shift; $index = $#jpgs if ($index > $#jpgs); while ((($index + 1)<= $#jpgs) && !eval {$image->read($jpgs[++ $in +dex], -shrink); 1}) { } if ($automode) { $mw->after($delay->get(), \&next_image) if (($index + 1) <= $# +jpgs); } $mw->configure(-title => $jpgs[$index]); $std = undef; } sub prev_image { $index -= shift; $index = 0 if ($index < 0); $automode = 0; while ((($index - 1) >= 0) && !eval {$image->read($jpgs[-- $index] +, -shrink); 1}) { } if ($index >= 0) { $mw->configure(-title => $jpgs[$index]); $std = undef; } }
Re: Using Perl to create a PowerPoint presentation
by eyepopslikeamosquito (Archbishop) on Oct 01, 2005 at 21:23 UTC

    To make HTML slide presentations quickly and easily, I use Spork. As described in the documentation, you write the slides in wiki-style markup language, then use the spork command to generate the HTML slides.

    To give a concrete example, here is the source code for the slides of a talk on Perl Best Practices I gave to Sydney.pm last week.

Re: Using Perl to create a PowerPoint presentation
by polypompholyx (Chaplain) on Oct 01, 2005 at 19:22 UTC
    I'm not sure why you can't just make the PowerPoint presentation in the usual way, but assuming you need to do it programatically, and that you have PowerPoint installed, you can use Win32::OLE to write it from Perl. You might find this example code I posted last week useful, as the documentation is somewhat lacking.
Re: Using Perl to create a PowerPoint presentation
by sauoq (Abbot) on Oct 01, 2005 at 17:45 UTC
    I need to build some sort of slideshow (preferably a PowerPoint presentation) which on each slide a picture (resizzed and all) and a little text (one line max).

    Uhm... so, why is it you want to use Perl for this?

    -sauoq
    "My two cents aren't worth a dime.";
    
      well I had to do a same sort of thing a year ago in powerpoint by hand (there are about 150 pictures which need to be put into this) and it took me a lot of work. I was hoping I could somehow automate this with perl (as it will come back every few months from now on)
        Try http://irfanview.com/ to batch-convert all of your pictures. It's free and works fine. I've no idea of how to automatically add all those shrinked pictures to your slides, but I wouldn't try to do it in perl. Alternatively I would try it in perl but without using Powerpoint. Maybe http://www.meyerweb.com/eric/tools/s5/ is a tool you would like to use for this kind of task, or the perl-based SPIP http://duehl.de/christian/perl/spip.html but it seems that there exists only a german documentation for it until now.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://496659]
Approved by puploki
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-23 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found