Hi.
I have PowerPoint slides with some text boxes and images. I want the script to take the top one (the is a title) and the one just below it, that is the main text, and change its properties. Just that, no change to the rest of the slide.
My script is like this, but:
- It only works if I “select all” first.
- It is using the selection X,Y in the “IF”, to it is formating them all the same.
What I need is to go to the slide, without selecting anything (if possible), and cycle to all text frames to check if they are the ones I need, and format them.
The two frames are not necessarily Shape 1 and Shape 2 on the slide.
tell application "Microsoft PowerPoint"
activate
--tell front document
set allShapes to shape range of selection of active window
set shapeCount to (count shapes of allShapes)
set shapeList to {}
set slideNumber to 31
repeat with i from 1 to shapeCount
tell shape i of allShapes
set positionX to left position
set positionY to top
set nameE to name
if positionX < 100 then
if positionY < 2 then
set properties to {top:{-2}, left position:{35}, width:{350}, height:{59.8}}
tell font of text range of text frame of allShapes
set font size to 24
set font color to ({0, 0, 0} as RGB color)
end tell
tell paragraph format of text range of text frame of allShapes
set space before to 0
set space after to 4
end tell
set name to "Main Title"
else
set properties to {top:{77}, left position:{35}, width:{360}, height:{280}}
tell font of text range of text frame of allShapes
set font size to 18
end tell
tell paragraph format of text range of text frame of allShapes
set space before to 0
set space after to 4
end tell
set name to "Main Text"
end if
end if
end tell
end repeat
end tell
My “logic” is to test if the frame is in the left portion of the screen (X < 100 will work for both), and if it is the top frame (Y < 2), format with font 24 (and etc.). and if it’s X < 100 and Y > 2, it’s enough to know it’s the other frame and format if with font 18 (and etc.).
Any idea? I got stuck and it should be simple.
Thank you,
Luiz