Applescript —找不到捆绑资源
我正在尝试为 Photoshop 编写一个 Applescript Droplet,用于调整多张照片的大小并为其添加水印。我想捆绑水印图像并保存为应用程序,以便我可以在我的组织内分发它,但我似乎无法让脚本查看捆绑的资源。
我将“watermark.png”图像拖到“捆绑内容”侧边栏,并使用以下文件处理语句:
on process_item(this_item)
set myPath to alias this_item as text
tell application "Adobe Photoshop CS5.1"
open file myPath
set thisDocument to current document
set ruler units of settings to pixel units
resize image thisDocument width 640
set wmPath to path to resource "watermark.png"
open file wmPath
end tell
end process_item
但我总是收到以下错误:
Resource not found.
我是否必须做一些特殊的事情来确保脚本可以找到捆绑的内容资源?
I'm trying to write an Applescript droplet for Photoshop that resizes and watermarks multiple photos. I want to bundle the watermark images and save as an app so I can distribute it within my organization, but I can't seem to get the script to see the bundled resource.
I dragged my "watermark.png" image to the "Bundle Contents" sidebar, and am using the following file processing statements:
on process_item(this_item)
set myPath to alias this_item as text
tell application "Adobe Photoshop CS5.1"
open file myPath
set thisDocument to current document
set ruler units of settings to pixel units
resize image thisDocument width 640
set wmPath to path to resource "watermark.png"
open file wmPath
end tell
end process_item
but I always get the following error:
Resource not found.
Do I have to do something special to make sure the script can find the bundled resources?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为您要求应用程序“Photoshop”查找资源。它不知道该怎么做。
要解决此问题,请将行
set wmPath to path to resource "watermark.png"
移到块tell application
之外(例如,在行tell 之前)应用程序“Adobe Photoshop CS5.1”
),或将其更改为:
It is because you are asking the application "Photoshop" to find the resource. It does not know how to do this.
To fix this, either move the line
set wmPath to path to resource "watermark.png"
outside of the blocktell application
(for example, before the linetell application "Adobe Photoshop CS5.1"
),or change it to: