Re: Getting current slide title in PowerPoint 2004
Re: Getting current slide title in PowerPoint 2004
- Subject: Re: Getting current slide title in PowerPoint 2004
- From: kai <email@hidden>
- Date: Tue, 30 Jan 2007 07:20:01 +0000
On 30 Jan 2007, at 01:35, Nir Soffer wrote:
On Jan 29, 2007, at 15:30, kai wrote:
IIRC, a slide's title (if it has one) is contained by the first
placeholder in its placeholders list, Nir.
I wish this was true :-)
The order of the shapes is the z order of the shapes on the slides.
Out of curiosity, I checked the PowerPoint 2004 AppleScript Reference
to see where I might have picked up the above impression. A statement
under "Class: place holder" (page 150) says pretty much the same
thing as I did. However, as you point out, that clearly depends on
the layer sequence. (And without such a qualification, the reference
is somewhat misleading.)
As Paul has pointed out (and as I reaffirmed for myself when I tried
it earlier), there's currently no way to filter application objects
using a whose clause.
However, it might be worth mentioning that, when analysing a complex
slide, the biggest delay in your repeat loop is caused by the number
of external calls to PowerPoint. If the slide contains (say) 50
elements, then that's how many calls are made to get each individual
shape.
It can be significantly faster to get all the comparison values in
one hit, and then iterate through the list in AppleScript. With a
busy slide, the following variation executes here some 3-4 times
faster than the original. (While the code could be optimised further,
the additional gains are not nearly as significant.)
[Assumes the presentation is running]
----------------
tell application "Microsoft PowerPoint"
set titleTypes to {placeholder type title placeholder, ¬
placeholder type center title placeholder, ¬
placeholder type vertical title placeholder}
tell active presentation to set currentSlide to slide ¬
(current show position of its slide show window's slide show view)
set slideTitle to ""
set typeList to placeholder type of currentSlide's place holders
repeat with i from 1 to count typeList
if typeList's item i is in titleTypes then
set slideTitle to content of text range of currentSlide's place
holder i's text frame
exit repeat
end if
end repeat
slideTitle
end tell
----------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden