InDesign Applescript调整放置图像的大小

时间:2015-02-23 13:22:06

标签: resize applescript adobe-indesign

请解释如何让applescript明白我想要选择活动页面上的所有图像(在我的情况下将是一个),调整图像大小并使框架适合内容。

tell application "Adobe InDesign CS6"
    set myPagecount to count pages of active document
    repeat with i from 1 to myPagecount
        set thisImage to select every graphic frame of page i
        tell content of thisImage
            set height to "11in"
            set width to "8.5in"
            fit given frame to content
        end tell
    end repeat
end tell

这显然不起作用......

谢谢!

2 个答案:

答案 0 :(得分:1)

只是为了给你一些想法:

tell application "Adobe InDesign CS5.5"
    activate
    set myPagecount to count pages of active document
    tell active document    
        set myPage to page 1
        tell page myPage
            tell item 1 of all graphics of myPage
                set geometric bounds of it to {10, 10, 0, 0}
            end tell
        end tell
    end tell
end tell

只需引用您的页面并循环浏览所有图形的集合。您需要更改几何边界的值,使用英寸的引号(“8.5in”)。

=================================

编辑:

上面的代码实际上调整了框架内图形/ pdf的大小。我添加了两个版本 - 一个用于pdf,另一个用于帧。您需要以几何边界设置值

tell application "Adobe InDesign CS6"
    activate
    set myPagecount to count pages of active document
    tell active document
        set myPage to page 1
        tell page myPage
            tell item 1 of all graphics of myPage
                set geometric bounds of it to {100, 100, 0, 0}
            end tell
            tell text frame 1 of myPage
                set geometric bounds of it to {100, 100, 0, 0}
            end tell
        end tell
    end tell
end tell

答案 1 :(得分:1)

这是最后的答案 - 感谢nicolai.kant!

tell application "Adobe InDesign CS6"
    set myPagecount to count pages of active document
    tell active document
        repeat with i from 1 to myPagecount
            set myPage to page i
            tell page myPage
                tell item 1 of all graphics of myPage
                    set geometric bounds of it to {"8.5in", "11in", 0, 0}
                    fit given frame to content
                end tell
            end tell
        end repeat
    end tell
end tell