Change paragraph style from X to Y in Pages Doc
Sorry for such a simple question, but I have looked through the Applescript manual and searched this forum and can't find a solution to my problem.
All I want to do is loop through the paragraphs of a Pages document and if the paragraph style is "Body Full", then change it to "Body Half". I have tried if statements repeat statements and everything I can think of but can't seem to get it to work. I can loop through all the paragraphs and change them to "Body Half", but as soon as I try to select only those whose paragraph style = "Body Full" it doesn't change any.
Here is an example of my attempt:
tell front document of application "Pages"
repeat with X from 1 to count (get paragraphs)
if paragraph style of paragraph X = "Body Full" then
set paragraph style of paragraph X to "Body Half"
end if
end repeat
end tell
If anyone could help I would be grateful. It's kind of embarrassing since I was a programmer for many years on mainframes and AS/400. Scripting is a new world to me.
Thanks in advance.
Jim
mac Pro, iMac, iPad, Ipod touch, Mac OS X (10.6.5)