Macbook で MS Powerpoint 2008 を使用しています。提供された Automator アクションを使用して、一連の画像 (100 程度) を新しい PPTX ファイルに追加しました。画像は中央に配置されていますが、完全には最大化されていません。使用できるエッジの周りに約 0.5 ~ 1 インチのスペースがあります。画像は、縦か横、または画像に適した方を最大化することを好みます。
画像 (形状) をスライドの高さ (7.5 インチ x 72 ピクセル/インチ) または幅 (10 インチまたは 720 ピクセル) に最大化する方がよいかどうかを判断するコードを追加する方法はありますか?
これまでの私のコードは次のとおりです。
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 height of theShape to (7.5 * 70)
set leftPos to (slide width of page setup of thePres) - (width of theShape)
set left position of theShape to (leftPos / 2)
set top of theShape to 0
end repeat
end tell
提案を実装した後の私の更新されたコードは次のとおりです。画像の幅が高さよりも幅が広いが、スライドの 7.5 x 10 と同じ比率ではない場合、サイズ変更後に高さがスライドの高さを超えていないことを確認するために、行を追加する必要がありました。
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
if height of theShape is greater than width of theShape then
set height of theShape to (7.5 * 72)
else
set width of theShape to (10 * 72)
end if
if height of theShape is greater than 540 then
set height of theShape to 540
end if
set leftPos to (slide width of page setup of thePres) - (width of theShape)
set left position of theShape to (leftPos / 2)
set top of theShape to 0
end repeat
end tell