图像是我工作的关键。
我正在尝试找到一种快速的方法来自动将图像插入到主题演讲中。我正在草拟的脚本是获取最后创建/下载的图像,并将其插入到Keynote上的当前幻灯片中,以代替母版对象占位符。
“基调出现错误:无法将文档ID \“ B1054797-9A07-4642-AE79-166D1DE72674 \”的幻灯片2的文件名设置为别名。”文件ID为“ B1054797-9A07-4642-AE79-166D1DE72674”的幻灯片2的文件名中的编号-10006到别名
set myFolder to "/Users/Mingyu/Desktop/UpperEchelon"
tell application "Finder" to set latestFile to item 1 of (sort files of (POSIX file myFolder as alias) by creation date) as alias
tell application "Keynote"
activate
tell the front document
tell the current slide
set thisPlaceholderImageItem to item 1
set file name of thisPlaceholderImageItem to ¬
alias
end tell
end tell
end tell
我希望脚本将在“ UpperEchelon”文件夹中将最后下载的图像插入到Keynote当前打开的幻灯片中
答案 0 :(得分:0)
两个问题:
thisPlaceholderImageItem
设置为image 1
,而不是item 1
file name
设置为latestFile
,而不仅仅是将其设置为alias
。这就是错误告诉您的内容。如果该文件夹是桌面的子文件夹,则语法要短得多
set myFolder to "UpperEchelon"
tell application "Finder" to set latestFile to item 1 of (sort files of folder myFolder by creation date) as alias
tell application "Keynote"
activate
tell the front document
tell the current slide
set thisPlaceholderImageItem to image 1
set file name of thisPlaceholderImageItem to latestFile
end tell
end tell
end tell