I am having a problem setting the value of an object property using the Win32::OLE module. Hopefully you can help.
I have written a script that takes screen shots of a Powerpoint presentation. Unfortunately, if a slide has animation on it, the script doesn't wait for the animation to be completed before it takes its screen shot, thus they are sometimes incomplete.
There are three properties of the AnimationSettings object I believe I need to set to ensure the animation is switched off and thus the slide has all the shapes visible before the screen shot is captured.
These are:
TextLevelEffect => ppTextLevelNone
EntryEffect => ppEffectNone
Animate => FALSE
According to the OLE/COM viewer, the constants I need above are activated by each property being set to 0.
The code below is a condensed version of my script, highlighting the problem.
The output from the console is as follows:#Global Powerpoint COM Objects. use Win32::OLE; my $PPt; my $PPtPresentation; my $PPtSSWindow; my $PPtSSView; $PPt = Win32::OLE->new("PowerPoint.Application") || die "Could not sta +rt PowerPoint.Application\n"; $PPtPresentation = $PPt->Presentations->Open( $filename ); $PPtSSWindow = $PPtPresentation->SlideShowSettings->Run(); $PPtSSView = $PPtSSWindow->View(); foreach my $shapes ( Win32::OLE::Enum->All($PPtSSView->Slide->{'Shapes +'} ) ) { my $animationSettings = $shapes->{'AnimationSettings'}; # ?set value like this? $animationSettings->{'TextLevelEffect'} = 0; $animationSettings->{'EntryEffect'} = 0; $animationSettings->{'Animate'} = 0; print "$animationSettings->{'TextLevelEffect'},"; print "$animationSettings->{'EntryEffect'},"; print "$animationSettings->{'Animate'}\n"; }
This is repeated for each shape on a slide. It indicates I only need to set the EntryEffect property for this particular presentation, as this property is set to 257 for each shape (ppEffectCut constant), the other two properties are set to 0.Win32::OLE(0.1502) error 0x80020009: "Exception occurred" in PROPERTYPUT "EntryEffect" at pdp_ppt.pl line 429 0,257,0 OLE exception from "Microsoft PowerPoint 2000":
Any help you can offer to successfully set the const values of these properties will be gratefully received. Cheers, Steve
In reply to Win32 OLE: setting an object property value by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |