applescript - AppleScript - Indesign 中的重新链接文件 - 无法从给定的 URI 创建链接资源
问题描述
我正在尝试在 Automator 中创建一个文件夹操作,该操作复制特定的 .indd 文件,在 InDesign 中打开它,然后将“test1.png”与拖放到文件夹中的文件重新链接,该文件绑定到 Automator 操作。
我可以让它使用硬编码的文件路径,但如果我尝试动态获取文件路径,它会给我错误“无法从给定的 URI 创建链接资源”
这可能很简单,但我是 AppleScript 的新手,无法弄清楚。
代码:
on run {input, parameters}
tell application "Finder"
set filename to name of file input
end tell
tell application "Adobe InDesign 2020"
if document 1 exists then
tell document 1
relink link "test1.png" to "Macintosh HD" & filename
try
update link "test1.png"
end try
end tell
end if
end tell
return input
结束运行
解决方案
我没有 Adobe InDesign 来测试这个但试试这个。
on run {input, parameters}
set theFile to input's item 1
tell application "Adobe InDesign 2020"
if document 1 exists then
tell document 1
relink link "test1.png" to theFile
try
update link "test1.png"
end try
end tell
end if
end tell
end run
推荐阅读
- rust - 为什么 Rust 找不到 wl_display_get_registry?
- python - 如何返回 JSON 请求输入并在另一个函数中使用它?
- python - 有没有更短的方法可以通过列表来实现?
- python - 无头 Chrome 浏览器 - 使用 Selenium 和 ChromeDriver
- c++ - 在 boost 中覆盖验证方法不适用于样式集
- scala - Scala 中的伴随对象和类访问
- android - Android:自定义 SearchView 布局
- python - 如何查看我的机器学习预测“偏离”多远?
- c# - .NET API 响应的必需属性
- swift - 喜欢大标题和 RefreshControl 不能正常工作