使用Indesign,如何通过脚本重现一系列菜单命令?

时间:2016-03-10 16:06:25

标签: applescript adobe-indesign

我有一个像这样的Indesign(CC2015)文档:

n pairs of ovals and polygons

手动,我可以使用此菜单命令序列获取n路径:

  1. 全选
  2. 对象 - >探路者 - >添加
  3. 释放复合路径
  4. the result

    如何使用Applescript或Javascript在脚本中获得相同的结果?

1 个答案:

答案 0 :(得分:1)

我为你写了一些代码,似乎做了你正在寻找的......

    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