Srinivas Balu
Srinivas Balu

Reputation: 1

apple script for pages and implementing into it

How to bring applescript written into pages'09. I am looking for a script to implement line spacing for the body text.The program I have written.

tell application "Macintosh HD:Applications:iWork '09:Pages.app"
    tell Untitled
        get properties of paragraph styles
        tell bodytext
            set properties to justify
            set line spacing to Double
        end tell
    end tell
end tell

Upvotes: 0

Views: 553

Answers (1)

fanaugen
fanaugen

Reputation: 1127

Here you go:

tell application "Macintosh HD:Applications:iWork '09:Pages.app"
    set thisDoc to front document   
    set line spacing of every paragraph style of thisDoc to 200
end tell

The value of line spacing is in percent, thus 200 will result in double line spacing.

EDIT: this, however, would set the line spacing everywhere in the document, not just the body text paragraphs. If you want only them, consider looping through them and changing their paragraph styles one by one:

    repeat with p in paragraphs of thisDoc
        set line spacing of p's paragraph style to 200
    end repeat

Upvotes: 1

Related Questions