How to add a new page to the bottom of a Pages document with AppleScript

565 Views Asked by At

I've been experimenting with the Pages object model and am trying to manipulate it with AppleScript. I'm able to use this command to add new pages to the document. make new page The problem I'm facing is that it always creates the new page at the beginning of the document instead of at the end of the document.

The dictionary says that the entire syntax is

set theResult to make new type class ¬
 at location specifier ¬
 with data anything ¬
 with properties record

and I've tried to use BOTTOM and END as values for location specifier, and they've been unsuccessful. What am I missing, please, to create a new page or a new section at the bottom of the document?

1

There are 1 best solutions below

6
vadian On

Just think in natural language.

You want to make a new page at the end of the sections in the front document

tell application "Pages"
    tell front document
        set newPage to make new page at the end of sections
    end tell
end tell