要定位InDesign中链接文件的“页面”属性,可以使用以下AppleScript代码示例:
tell application "Adobe InDesign"
set targetFile to choose file with prompt "Select the linked file:"
set targetLink to link of link where name of link file is (targetFile as string)
set targetPage to parent page item of parent story of targetLink
set targetPageIndex to index of targetPage
display dialog "The linked file is on page " & targetPageIndex
end tell
这段代码首先使用choose file
命令让用户选择一个链接文件。然后,它通过比较链接文件的名称来找到匹配的链接。接下来,它获取链接的父级故事的父级页面项,并获取该页面项在文档中的索引。最后,它使用display dialog
命令显示链接文件所在的页面索引。
请注意,这段代码假设用户已经打开了一个InDesign文档,并且选择的链接文件确实在文档中存在。如果用户没有打开文档或选择的链接文件不在文档中,代码可能会引发错误。