InDesign Applescript 调整置入图像的大小

InDesign Applescript Resizing Placed Images

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

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

这显然行不通...

谢谢!

只是给你一些想法:

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")。

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

已编辑:

上面的代码实际上在框架内调整了 graphics/pdf 的大小。我添加了 2 个版本 - 一个用于 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

这是最终答案 - 感谢 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