How to add word count to Pages document footer?

Can't add my word count to the pages footer.


[Re-Titled by Moderator]

Posted on Mar 5, 2025 06:02 PM

Reply
1 reply

Mar 6, 2025 05:53 AM in response to willowmoon

Pages can display the word count in a floating panel at the bottom of the document but that word count is not user-assignable to the document body, header, or footer panels.


In Finder, press shift+cmd+U to open the Utility folder. Double-click the Script Editor application to launch it.


Copy/paste the following AppleScript code into the script editor, click the hammer icon to compile it, and then click Run. This will prompt you to select a Pages document (only), open that document, and display the same word count as Pages shows in its floating count panel. You can select, copy, and paste that integer word count from the AppleScript dialog into the Pages footer.


This script counts words in the user's default language.



-- Pages_wordcount.applescript

use framework "Foundation"
use AppleScript version "2.5"
use scripting additions

property ca : current application

set thisDoc to (choose file of type {"com.apple.iwork.pages.sffpages"})

tell application "Pages"
	activate
	open thisDoc
	tell front document to set T to its body text
	close front document
end tell

tell application "Pages" to if it is running then quit

set wordcount to (ca's NSSpellChecker's sharedSpellChecker)'s countWordsInString:T |language|:""

tell application "Finder"
	display dialog (wordcount) as text with title "Document Word Count"
end tell
return


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 to add word count to Pages document footer?

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