Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript Help - Align photos in Powerpoint

Hello,

I have the below applescript and I want it to align the photos that I have in Powerpoint (1 photo per slide) to center them all.

Please tell me what I am doing wrong.

Thanks.

tell application "Microsoft PowerPoint"

activate

set thePres to active presentation

set slideCount to count slides of thePres

repeat with a from 1 to slideCount

set theShape to first shape of slide a of thePres

set width of theShape to (8 * 70)

set alignment of every slide of active presentation to align shape center -- This is not working!!!!

end repeat

end tell

MacBook Pro (13-inch Mid 2010), Mac OS X (10.7.3)

Posted on Oct 27, 2012 2:01 PM

Reply
Question marked as Best reply

Posted on Oct 28, 2012 9:26 AM

Hi,


There is nothing in the AppleScript dictionary of "Microsoft PowerPoint" to set shape's alignment, at least on my version, as Microsoft has not really added others (commands or properties) since 2004, I believe that the alignment of the shape has not been added, but I may be wrong.


So it must be done by calculation.

------------------------

set imgWidth to (8 * 70)

tell application "Microsoft PowerPoint"

activate

tellactive presentation

set slideCount to count slides

set {height:slideHeight, width:slideWidth} toslide masterofslide 1

repeat with a from 1 to slideCount

tell picture 1 of slide a

set width to imgWidth

set properties to {top:((slideHeight - height) div 2), left position:((slideWidth - imgWidth) div 2)}

end tell

end repeat

end tell

endtell

------------------------

2 replies
Question marked as Best reply

Oct 28, 2012 9:26 AM in response to pjdube

Hi,


There is nothing in the AppleScript dictionary of "Microsoft PowerPoint" to set shape's alignment, at least on my version, as Microsoft has not really added others (commands or properties) since 2004, I believe that the alignment of the shape has not been added, but I may be wrong.


So it must be done by calculation.

------------------------

set imgWidth to (8 * 70)

tell application "Microsoft PowerPoint"

activate

tellactive presentation

set slideCount to count slides

set {height:slideHeight, width:slideWidth} toslide masterofslide 1

repeat with a from 1 to slideCount

tell picture 1 of slide a

set width to imgWidth

set properties to {top:((slideHeight - height) div 2), left position:((slideWidth - imgWidth) div 2)}

end tell

end repeat

end tell

endtell

------------------------

Applescript Help - Align photos in Powerpoint

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.