insert filename into footer
Hi Everyone,
Can you tell me if it's possible to insert a filename into a footer in Pages, so that the filename and it's directory path is shown when you print it?
Cheers 🙂
MP, Mac OS X (10.5.6), null
Hi Everyone,
Can you tell me if it's possible to insert a filename into a footer in Pages, so that the filename and it's directory path is shown when you print it?
Cheers 🙂
MP, Mac OS X (10.5.6), null
Not directly from the Pages application.
Whether in a custom template, or current document, you can enter the string "[Filename]" without the quotes just once in the footer of the first page where you want the filename to appear. Select all of that string, and from the Format menu : Advanced, select Define as Placeholder Text. The text will become salmon colored to confirm this, on every page of the section where you entered this footer text. If subsequent sections match the previous section, then on all pages of your document.
To replace every occurrence of that Placeholder text with the document name, after you have satisfied paragraph one, you would need to run the following AppleScript, which you can copy/paste into Script Editor (Dock : Launchpad : Other : Script Editor). Click the hammer icon, and then click run to see your document name inserted into every footer.
set nameStr to "[Filename]" -- placeholder text in footer of document
set theseTags to {}
tell application "Pages"
tell front document
activate
set theName to name of it
set theseTags to the tag of every placeholder text whose tag is equal to nameStr
repeat with i from 1 to count of theseTags
set thisTag to itemi of theseTags
set (every placeholder text whose tag is thisTag) to theName as text
end repeat
end tell
end tell
return
This was tested on Pages v7.2 on High Sierra 10.13.6 (17G65). It should work just fine on Mojave too.
Not directly from the Pages application.
Whether in a custom template, or current document, you can enter the string "[Filename]" without the quotes just once in the footer of the first page where you want the filename to appear. Select all of that string, and from the Format menu : Advanced, select Define as Placeholder Text. The text will become salmon colored to confirm this, on every page of the section where you entered this footer text. If subsequent sections match the previous section, then on all pages of your document.
To replace every occurrence of that Placeholder text with the document name, after you have satisfied paragraph one, you would need to run the following AppleScript, which you can copy/paste into Script Editor (Dock : Launchpad : Other : Script Editor). Click the hammer icon, and then click run to see your document name inserted into every footer.
set nameStr to "[Filename]" -- placeholder text in footer of document
set theseTags to {}
tell application "Pages"
tell front document
activate
set theName to name of it
set theseTags to the tag of every placeholder text whose tag is equal to nameStr
repeat with i from 1 to count of theseTags
set thisTag to itemi of theseTags
set (every placeholder text whose tag is thisTag) to theName as text
end repeat
end tell
end tell
return
This was tested on Pages v7.2 on High Sierra 10.13.6 (17G65). It should work just fine on Mojave too.
Wow, thanks VikingOSX, that's super useful and I'll give it a go later today when I get a second. It's probably really easy to run, but I'll try it out when I've got 15 mins spare just in case!
Many thanks again, 😻
insert filename into footer