![](/img/trans.png)
[英]Using Applescript run powerpoint slide show of specified slide in the presentation
[英]Align photo in Powerpoint slide using Applescript
我試圖使用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
但沒有樂趣
如何將圖像設置在幻燈片的中央或水平分布?
謝謝亞當。
在這種情況下,我似乎無法使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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.