我试图使用AppleScript在Powerpoint中对齐照片,但找不到正确的语法。
set theMedia to make new picture at end with properties {file name:theMediaFile, lock aspect ratio:true, top:0, width:1280, height:720}
我尝试过
distribute theMedia distribute type distribute horizontally with relative to slide
但是没有喜悦
如何将图像设置在幻灯片的中央或水平分布?
谢谢 亚当。
答案 0 :(得分:1)
在这种情况下,我似乎无法使用align
或distribute
函数。他们俩似乎都需要shape ranges
作为输入(而不是单个形状),而且我不太明白如何根据单个形状来构造形状范围。
但是,通过从幻灯片的中心点减去一半的图片宽度/高度并将其设置为图片原点,可以很容易地以老式的方式将图片居中:
tell application "Microsoft PowerPoint"
(*
'thePic' and 'theSlide' are references to the picture
and the slide, respectively.
*)
set {slideHeight, slideWidth} to get {height, width} of custom layout of theSlide
set {picHeight, picWidth} to get {height, width} of thePic
set XPos to slideWidth / 2 - picWidth / 2
set YPos to slideHeight / 2 - picHeight / 2
tell thePic
set {left position, top} to {XPos, YPos}
end tell
end tell