使用 Indesign,如何通过脚本重现一系列菜单命令?
With Indesign, how to reproduce a sequence of menu commands via script?
我有一个这样的 Indesign (CC2015) 文档:
手动,我可以使用此菜单命令序列获得 n
个路径:
- Select全部
- 对象 –> 探路者 –> 添加
- 发布复合路径
如何使用 Applescript 或 Javascript 的脚本获得相同的结果?
我为您编写了一些代码,似乎可以满足您的需求...
tell application "Adobe InDesign CC 2015"
tell document 1
set pgs to every page
repeat with aPage in pgs
set pageItems to every page item of aPage
set previousItem to ""
if pageItems is not equal to {} then
repeat with anItem in pageItems
if previousItem = "" then
set previousItem to anItem
set finalItem to ""
else
set workingItem to previousItem
set previousItem to anItem
set finalItem to add path workingItem with anItem
end if
end repeat
if finalItem is not equal to "" then
set theResult to release compound path finalItem
end if
end if
end repeat
end tell
end tell
我有一个这样的 Indesign (CC2015) 文档:
手动,我可以使用此菜单命令序列获得 n
个路径:
- Select全部
- 对象 –> 探路者 –> 添加
- 发布复合路径
如何使用 Applescript 或 Javascript 的脚本获得相同的结果?
我为您编写了一些代码,似乎可以满足您的需求...
tell application "Adobe InDesign CC 2015"
tell document 1
set pgs to every page
repeat with aPage in pgs
set pageItems to every page item of aPage
set previousItem to ""
if pageItems is not equal to {} then
repeat with anItem in pageItems
if previousItem = "" then
set previousItem to anItem
set finalItem to ""
else
set workingItem to previousItem
set previousItem to anItem
set finalItem to add path workingItem with anItem
end if
end repeat
if finalItem is not equal to "" then
set theResult to release compound path finalItem
end if
end if
end repeat
end tell
end tell