Using AppleScript I want to update existing footer with additional words
example: I have “Hello 1. Organization” is in footer and I want to add a new word.
You don’t explain what or where you would add but this should let you set the footer to whatever you like. Note that the three parts of the footer are separated with the tab character, not a collection of space characters.
tell application "Microsoft Word"
set s1 to section 1 of active document
set content of text object of (get footer s1 index header footer primary) ¬
to "Good-bye 1. Organization"
end tell
You can edit the three text elements like this:
tell application "Microsoft Word"
-- get current footer
set s1 to section 1 of active document
set tf1 to content of text object of (get footer s1 index header footer primary)
set tf1 to text 1 through -2 of tf1
--> "Good-bye 1. Organization"
set AppleScript's text item delimiters to tab
set tfList to text items of tf1
--> {"Good-bye", "1.", "Organization"}
-- edit text for footer
set item 1 of tfList to "Hello " & item 1 of tfList
tfList
--> {"Hello Good-bye", "1.", "Organization"}
-- set footer to edited text
set tf1 to tfList as text
set AppleScript's text item delimiters to ""
set content of text object of (get footer s1 index header footer primary) to tf1
end tell