I have successfully built a script to export my PowerPoint files - saving each slide as a separate png file. Some of the slides have Notes attached to them. Is there a way to access the notes of a slide? http://www.pptfaq.com/FAQ00178.htm shows how to delete notes using a "NotesPage" object but I am not sure how to translate that into getting the notes text. Your help would be greatly appreciated.

UPDATE
After messing around for a while I was able to get the notes. I have updated the script below to reflect it

#!/usr/bin/perl -w # use strict; use Win32::OLE qw( in valof with CP_UTF8 ); Win32::OLE->Option( CP => CP_UTF8 ); $Win32::OLE::Warn = 3; use Win32::OLE::Const; my $ole_const = { %{ Win32::OLE::Const->Load("Microsoft PowerPoint 12.0 Object Libra +ry") }, %{ Win32::OLE::Const->Load("Microsoft Office 12.0 Object Library") + }, }; $ole_const->{ppShapeFormatPNG} = 2; # Create PowerPoint OLE server. OLE server should 'Quit' if the script + dies unexpectedly. my $ppt = Win32::OLE->GetActiveObject('Powerpoint.Application') || Win32::OLE->new( 'PowerPoint.Application', 'Quit' ) || die "Can't create PowerPoint OLE: $!\n"; # Powerpoint must be visible to work $ppt->{Visible} = 1; #set some variables $|=1; $0 = $^X unless ($^X =~ m%(^|[/\\])(perl)|(perl.exe)$%i); my ($progpath) = $0 =~ m%^(.*)[/\\]%; $progpath ||= "."; my $pptfile = "$progpath\\test.ppt"; my $width=800; my $height=600; my $saveas="PNG"; #Open the powerpoint file print "Opening $pptfile\n"; if(!-s $pptfile){die $!;} my $pres = $ppt->Presentations->Open( $pptfile ); if(!$pres){die $!;} #interate through the slides and save each slide as a PNG SLIDE: for my $slide ( in $ppt->ActivePresentation->Slides ) { my $num=$slide->{SlideNumber}; my $pngfile="$progpath\\slide$num\.$saveas"; print "Exporting Slide $num\n"; $slide->Export($pngfile,$saveas,$width,$height); my $note=getSlideNotes($slide); if($note){ print " - NOTES: $note\n"; } print "-"x40 . "\n"; next SLIDE; } $pres->Close(); ############ sub isNum{ my $str=shift; if(!length($str)){return 0;} if($str=~/^\-*?[0-9\.]+$/is){ #make sure there is only one decimal (125.265.21.23 is not a +number) my @parts=split(/\./,$str); if(scalar @parts < 3){return 1;} } return 0; } ############### sub getSlideNotes{ my $slide=shift || return ''; #Get the text for this slide my @slidenotes=(); my $notes=$slide->NotesPage; my $notes_cnt=$notes->Count; if($notes_cnt){ for my $note (in $notes){ #Does this note have shapes my $shapes=$note->Shapes; my $shapes_cnt=$shapes->Count; if($shapes_cnt){ for my $shape (in $shapes){ next unless $shape->HasTextFrame; my $pars=$shape->TextFrame->TextRange->Paragraphs +; my $pars_cnt=$pars->Count; if($pars_cnt){ for my $par (in $pars){ my $txt=$par->Text; $txt=~s/^[\s\t]+//s; $txt=~s/[\s\t]+$//s; if(length($txt) && !isNum($txt)){ push(@slidenotes,$txt); } } } else{ my $txt=$shape->TextFrame->TextRange->Text; $txt=~s/^[\s\t]+//s; $txt=~s/[\s\t]+$//s; if(length($txt) && !isNum($txt)){ push(@slidenotes,$txt); } } } } } } my $slidenotes_cnt=@slidenotes; if($slidenotes_cnt){ my $notes=join("\n",@slidenotes); return $notes; } return ''; }
s/te/ve/

In reply to Getting Slide Notes from PowerPoint files by slloyd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.