[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

Re: Controlling white space around graphic frames



Bart Windrum wrote:

>I want to ensure common, preformatted amounts of white space above and below
>graphic frames used to hold screenshots. Frame heights will vary (widths
>will be common, the full column measure).

Since you're using a Mac...

I wrote an AppleScript that did most of what you're looking for
some time ago. It resizes the selected frame height to put 8pt
borders above & below the graphic, and centers the graphic in the
frame.


/* Fcodes used in this script */
set SelectAll to 807
set GroupCmd to 898
set UngroupCmd to 899

set GroupedIt to false

tell application "FrameMaker+SGML 6.0"
    if (class of selection is anchored frame) then

        set s to selection
        set theWidth to (width of s)

        -- collect everything into one group if needed
        if (count graphic objects of s) > 1 then
            Frame commands {SelectAll, GroupCmd}
            set GroupedIt to true
        end if

        set b to bounds of (graphic object 1 of s)
        -- bounds list is {top, left, bottom, right} in points
        -- relative to anchored frame's upper-left corner

        -- 8 points of space from top & bottom of anchored frame
        set item 3 of b to ((item 3 of b) - (item 1 of b) + 8.0)
        set item 1 of b to 8.0
        set height of s to (item 3 of b) + 8.0

        -- center the contents horizontally
        set objWidth to ((item 4 of b) - (item 2 of b))
        set item 2 of b to ((theWidth - objWidth) / 2.0)
        set item 4 of b to (objWidth + (item 2 of b))
        set bounds of (graphic object 1 of s) to b

        -- ungroup if needed
        if (GroupedIt) then
            select graphic object 1 of s
            Frame commands {UngroupCmd}
        end if

    else
        display dialog "Select an anchored frame first."
    end if
end tell

--
Larry Kollar, Senior Technical Writer, ARRIS
"Do not look into laser with remaining eye."



** To unsubscribe, send a message to majordomo@omsys.com **
** with "unsubscribe framers" (no quotes) in the body.   **