【问题标题】:InDesign Applescript Resizing Placed ImagesInDesign Applescript 调整放置图像的大小
【发布时间】:2015-02-24 03:36:40
【问题描述】:

请解释如何让 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

这显然行不通……

谢谢!

【问题讨论】:

    标签: resize applescript adobe-indesign


    【解决方案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 的大小。我添加了 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
    

    【讨论】:

    • 对不起,什么不起作用?我注意到我指的是CS5.5,你把它改成6了吗?尝试更改几何界限,您可能有不同的默认值。我在发布它之前尝试了这个脚本并花了一些时间试图提供帮助。我没有为您发布现成的解决方案,这只是一个示例。您需要阅读并理解代码。例如。您实际上在第一页上有一个图形框架吗?仅仅说它不起作用并不能鼓励我或其他人继续。
    • 好的。我在 Indesign 中放置了一个 PDF 文件,我想将其宽度更改为 11 英寸,将其高度更改为 8.5 英寸。之后我希望框架适合实际的 PDF。我认为从我的问题中的伪代码中可以清楚地看到......每一页只有一个矩形 - 我放置的 PDF 文件。所以是的,我相信那是一个图形框架......顺便说一句:我没有把它改成 CS6 - 从一开始就是这样......
    • 5.5 是我的版本并出现在我的代码中,如果您运行它,您需要将其替换为 6 - 这是您的 InDesign 版本。抱歉,不清楚。
    • 不,当您说它不能用作评论时,尚不清楚。运行我的脚本时是否收到错误消息?它根本不运行?电脑着火了?您是否希望我发布完整的重写,以便您可以复制和粘贴?当我运行您的脚本时,“图形框架”出现错误,因此我建议循环浏览页面的“所有图形”项目,或者如果您只放置一个框架,请参考项目 1。
    • 耶!有效!文本框架不起作用,所以我会将最终结果放在我的答案中。非常感谢,感谢您的耐心;-)
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2023-01-26
      • 2020-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多