Can';无法获取Applescript以更改InDesign中文本框的段落样式

Can';无法获取Applescript以更改InDesign中文本框的段落样式,applescript,adobe,stylesheet,adobe-indesign,Applescript,Adobe,Stylesheet,Adobe Indesign,我正在尝试编写一个“简单”的applescript,它将在InDesign中找到一个具有特定属性的文本框,然后更改该特定文本框的段落样式。我知道if语句是正确的,因为我将它用于其他applescripts。 所以我有一个对象样式为“PriceBox”的文本框。如果文本框中包含斜杠“/”,我想将段落样式更改为“2for”。我确认文档中存在段落样式。但是,当我运行脚本时,会出现以下错误: 错误“无法将应用程序\“Adobe InDesign CC 2015\”的文档id 4的«class sprd»

我正在尝试编写一个“简单”的applescript,它将在InDesign中找到一个具有特定属性的文本框,然后更改该特定文本框的段落样式。我知道if语句是正确的,因为我将它用于其他applescripts。 所以我有一个对象样式为“PriceBox”的文本框。如果文本框中包含斜杠“/”,我想将段落样式更改为“2for”。我确认文档中存在段落样式。但是,当我运行脚本时,会出现以下错误:

错误“无法将应用程序\“Adobe InDesign CC 2015\”的文档id 4的«class sprd»id 6891的«class txtf»id 6905的«class psty»设置为应用程序\“Adobe InDesign CC 2015\”的«class psty»编号-10006,从«class txtf»id 6905的«class sprd»id 6891的«class psty»设置为«class 2for»

我尝试过“设置段落样式”脚本的各种变体,但它们似乎都不起作用。请帮忙!=)谢谢大家!

告诉应用程序“Adobe InDesign CC 2015”

结束通话

您测试的是“/$”而不仅仅是“/”

不能直接将段落样式应用于文本框。你需要使用段落

还需要在帧之间循环

tell application "Adobe InDesign CC 2015"
    tell active document
        set horizontal measurement units of view preferences to inches
        set vertical measurement units of view preferences to inches
        repeat with x from 1 to count pages
            set ThisPage to page x
            tell ThisPage
                if exists (text frames whose (name of applied object style is "PriceBox" and contents contains "/$")) then

                    set myFrames to (text frames whose (name of applied object style is "PriceBox" and contents contains "/$")))
                    tell myFrames
                        repeat with r from 1 to count items
                            set applied paragraph style of paragraphs of item r of myFrames to "2For"
                        end repeat
                    end tell
                end if
            end tell
        end repeat
    end tell
end tell
您正在测试“/$”而不仅仅是“/”

不能直接将段落样式应用于文本框。你需要使用段落

还需要在帧之间循环

tell application "Adobe InDesign CC 2015"
    tell active document
        set horizontal measurement units of view preferences to inches
        set vertical measurement units of view preferences to inches
        repeat with x from 1 to count pages
            set ThisPage to page x
            tell ThisPage
                if exists (text frames whose (name of applied object style is "PriceBox" and contents contains "/$")) then

                    set myFrames to (text frames whose (name of applied object style is "PriceBox" and contents contains "/$")))
                    tell myFrames
                        repeat with r from 1 to count items
                            set applied paragraph style of paragraphs of item r of myFrames to "2For"
                        end repeat
                    end tell
                end if
            end tell
        end repeat
    end tell
end tell