Macos 使用Applescript对齐Powerpoint幻灯片中的照片

Macos 使用Applescript对齐Powerpoint幻灯片中的照片,macos,applescript,powerpoint,Macos,Applescript,Powerpoint,我试图使用AppleScript在Powerpoint中对齐照片,但找不到正确的语法 将MEMEDIA设置为在末尾创建新图片,属性为{文件名:MEMEDIAFILE,锁定纵横比:true,顶部:0,宽度:1280,高度:720} 我试过了 分发主题分发类型相对于幻灯片水平分发 但是没有快乐 如何将图像设置在幻灯片的中心或水平分布 谢谢 Adam.在这种情况下,我似乎无法让align或distribute函数工作。它们似乎都需要输入形状范围,而不是单个形状,我不太明白如何从单个形状构造形状范围

我试图使用AppleScript在Powerpoint中对齐照片,但找不到正确的语法

将MEMEDIA设置为在末尾创建新图片,属性为{文件名:MEMEDIAFILE,锁定纵横比:true,顶部:0,宽度:1280,高度:720}

我试过了

分发主题分发类型相对于幻灯片水平分发 但是没有快乐

如何将图像设置在幻灯片的中心或水平分布

谢谢 Adam.

在这种情况下,我似乎无法让align或distribute函数工作。它们似乎都需要输入形状范围,而不是单个形状,我不太明白如何从单个形状构造形状范围

但是,通过从幻灯片的中心点减去一半的图片宽度/高度,并将其设置为图片原点,可以很容易地以老式的方式将图片居中:

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