Apple Script (?) to change font and size within a Pages document
I am a 100% newbie to Apple Script so I am struggling, but I need something that will enable me to change all occurances of specific font and size within a Pages document, to a different font/size.
It is a huge document so I m struggling to do this manually within pages as the occurances are scattered throughout the text and 'contained' in several Text styles
I have tried to following Apple Script...
tell application "Pages"
tell front document
tell body text
set matchingWords to every word where its font is "Cambria" and size is 11
repeat with w in matchingWords
set font of w to "Avenir"
set size of w to 14
end repeat
end tell
display dialog "Font and size replacement complete! All Cambria (size 11) text changed to Avenir (size 14)." buttons {"OK"} default button 1
end tell
end tell
The script runs, with no Error messages.. but the source document is not being changed at all. So I am assuming my code to identify the 'matrching words' is not working.
Does anyone have any pointers or suggestions as to how I can get this to work?
Thanks
iMac 27″ 5K, macOS 13.7