AppleScript for Pages can't modify a templated file

Discussion in 'Mac Programming' started by campbellum, Oct 19, 2015.

  1. campbellum macrumors newbie

    Joined:
    Oct 19, 2015
    #1
    I use this AppleScript to create a new Pages document with some standard titles and verbiage:

    tell application "Pages"
    activate
    set myDoc to make new document with properties {document template:template "MyTemplate"}
    set paragraph 1 of body text of myDoc to (current date as text)
    end tell

    The "set" is meant to write over a dummy line provided by the template and replace it with the date. However, the line is not changed. I have tried scripts that I found online, and they all have the same effect: the script refuses to modify text provided by the Pages template.
    After the script exits, though, I can edit the line, so it's not read-only.

    What is happening?
    (Yosemite, Pages 5.6, Script Editor 2.7)
     
  2. campbellum thread starter macrumors newbie

    Joined:
    Oct 19, 2015
    #3

Share This Page