Hello,
I know enough Applescript to be dangerous. I can do more in Indesign, but I just got a client who wants me to work only in Word (its a book layout). He’s got hundred of individual files and wants a new template with a new footer to replace an old template and footer. I wrote a successful script to replace the template (easy peezy), but I’m a little lost on the footer.
Normally I find something on the web and adapt it. So I found it on Word’s site and adapted it to this:
on ReplaceInFooters(findText, replaceText)
local theFooters, theFooter
tell application "Microsoft Word"
set allSections to every section of active document
repeat with theSection in allSections
set theFooters to {get footer theSection index header footer primary} & {get footer theSection index header footer first page} & {get footer theSection index header footer even pages}
repeat with theFooter in theFooters
set theRange to text object of theFooter
my ReplaceInRange(findText, replaceText, theRange)
end repeat
end repeat
end tell
end ReplaceInFooters
on ReplaceInRange(findText, replaceText, theRange)
tell application "Microsoft Word"
set findObject to find object of theRange
tell findObject
set format to false
set content to findText
set content of its replacement to replaceText
set wrap to find stop
end tell
execute find findObject replace replace all
end tell
end ReplaceInRange
and I want to add this to my script. Trouble is, the found script doesn’t indicate where to put the values for the findText variable or for the replaceText variable. I know it seems a dumb question, but I am not a programmer by trade. However, I don’t want to have manually open up every doc and paste the new footer text in.
And why can’t I just write:
set findText to “Copyright 2007”
set replaceText to “Copyright 2009”
after "tell application “Microsoft Word” and before “set findObject to find object of theRange”
?