通过applescript获取indesign文本框的内容

Getting contents of indesign text frame through applescript

我正在尝试构建一个 applescript,它将在 indesign 中读取一个文本框架的内容,如果该框架包含字符“/”,那么它将移动另一个文本框架。我想出了如何让另一个文本框移动,但我想不出一种方法来制作 applescript "read" 第一个文本框中的内容并搜索字符。这是我目前所拥有的...

tell application "Adobe InDesign CS6"
    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 (get text frames whose name of applied object style is "Box1") contains character "/" then
                    move (get text frames whose name of applied object style is "Box2") by {-1.245, 0} --relative move x, y 
                end if
            end tell
        end repeat
    end tell
end tell

我没有收到任何错误,但它不会执行任何操作,否则它会给我编译器错误。请帮忙!谢谢!

为您的 "if" 测试

试试这个

if exists (text frames whose (applied object style name is "Box1" and contents contains "/"))