how do I insert the file name in the document or the footer, say.

How do I insert the file name...or even the path...in the document itself, or in the footer?


Using Pages 5.5.3, iMac OSX Yosemite 10.10.3.


Thanks!

iMac (21.5-inch Late 2009), Mac OS X (10.7.3)

Posted on Jun 14, 2015 4:08 PM

Reply
10 replies

Jun 21, 2015 12:42 PM in response to Joseo

You have multiple choices.

  1. Use Pages '09 or Word as has been suggested.
  2. Click on your Pages document title, copy/paste the pre-selected document name into your document.
  3. Exclusive to Pages v5.5 or later on Yosemite
    1. Embed placeholder text in the header and/or footer of a template, or in your document body as needed.
      1. [Filename]
      2. [Filepath]
    2. Set placeholder text via Format menu > Advanced > Define as Placeholder Text
    3. Use an AppleScript that replaces these respective placeholder tag names with the document name and path.
    4. Make a new Pages document that has the above strings in the header, and footer respectively, and save it with a name.
    5. Copy/Paste the following AppleScript into the Script Editor on Yosemite, Compile it, and Run it. Observe the document updates.


AppleScript Code (Yosemite or later only):


-- AppleScript for Yosemite (or later) and Pages v5.5 (or later)

-- Change every occurrence of the following property strings in a Pages document

-- by replacement of the respective placeholder text fields.

-- Consider use of a custom template with header/footer placeholder text strings.

-- VikingOSX, June 2015, Apple Support Community


property tagStr1 : "[Filename]"

property tagStr2 : "[Filepath]"



tell application "Pages"


tell front document


set theTagName to the tag of every placeholder text whose tag is equal to tagStr1

set theTagPath to the tag of every placeholder text whose tag is equal to tagStr2


set docName to name of it as text

set docPath to file of it as text

set docPath to (POSIX path of docPath) as text


if text -1 of docPath is equal to "/" then

-- trim trailing slash from package folder path

set docPath to text 1 thru -2 of (POSIX path of docPath) as text

end if


if (count of theTagName) is not equal to 0 then

repeat with i from 1 to count of theTagName

set thisTag to itemi of theTagName

set (every placeholder text whose tag is thisTag) to docName

end repeat

end if


if (count of theTagPath) is not equal to 0 then

repeat with i from 1 to count of theTagPath

set thisTag to itemi of theTagPath

set (every placeholder text whose tag is thisTag) to docPath

end repeat

end if


end tell

end tell

Jun 25, 2015 3:11 AM in response to VikingOSX

You have multiple choices.

  1. Use Pages '09 or Word as has been suggested.
  2. Click on your Pages document title, copy/paste the pre-selected document name into your document.
  3. Exclusive to Pages v5.5 or later on Yosemite
    1. Embed placeholder text in the header and/or footer of a template, or in your document body as needed.
      1. [Filename]
      2. [Filepath]
    2. Set placeholder text via Format menu > Advanced > Define as Placeholder Text
    3. Use an AppleScript that replaces these respective placeholder tag names with the document name and path.
    4. Make a new Pages document that has the above strings in the header, and footer respectively, and save it with a name.
    5. Copy/Paste the following AppleScript into the Script Editor on Yosemite, Compile it, and Run it. Observe the document updates.


AppleScript Code (Yosemite or later only):


-- AppleScript for Yosemite (or later) and Pages v5.5 (or later)

-- Change every occurrence of the following property strings in a Pages document

-- by replacement of the respective placeholder text fields.

-- Consider use of a custom template with header/footer placeholder text strings.

-- VikingOSX, June 2015, Apple Support Community


property tagStr1 : "[Filename]"

property tagStr2 : "[Filepath]"



tell application "Pages"


tell front document


set theTagName to the tag of every placeholder text whose tag is equal to tagStr1

set theTagPath to the tag of every placeholder text whose tag is equal to tagStr2


set docName to name of it as text

set docPath to file of it as text

set docPath to (POSIX path of docPath) as text


if text -1 of docPath is equal to "/" then

-- trim trailing slash from package folder path

set docPath to text 1 thru -2 of (POSIX path of docPath) as text

end if


if (count of theTagName) is not equal to 0 then

repeat with i from 1 to count of theTagName

set thisTag to itemi of theTagName

set (every placeholder text whose tag is thisTag) to docName

end repeat

end if


if (count of theTagPath) is not equal to 0 then

repeat with i from 1 to count of theTagPath

set thisTag to itemi of theTagPath

set (every placeholder text whose tag is thisTag) to docPath

end repeat

end if


end tell

end tell

"IT JUST WORKS"

Jun 21, 2015 7:39 AM in response to Joseo

This is essential. Why do they remove such basics? This is insanity.


I loaded an old Pages document into the "new & improved" Pages to have it break things. Not even MS are this incompetent. I'm posting review on MAS now.


Papyrus on my Atari ST had this 20 odd years ago. Pages is quickly moving into the toy town category.


Seriously, the lead developer of Pages needs a good kick in the you know what.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

how do I insert the file name in the document or the footer, say.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.