Ive been following the Adobe InDesign CS6 AppleScript Scripting Guide, and I'm trying to change text I have set up.
Currently it works, but it only changes the exact string "Apple" to "Pear"
Is it possible to have findword set up as a list of strings like "apple", "fruit". I tried making it a list but got this error "Invalid value for set property 'find what'. Expected string or nothing,
Also when it changes the text I want to to completely clear the indesign text box and replace it with changeWord
right now if anything comes after "Apple" like Apple123 it will change it to "Pear123". I need it to clear the text box and place changeWord in the text box
Any advice would be greatly appreciated, or just being pointed in the right direction.
Thanks!
set findWord to "Apple"
--establish text for change
set changeWord to "Pear"
tell application "Finder" to set indesignFiles to (files of folder "test1" whose name extension is "indd") as alias list
tell application "Adobe InDesign CC 2015"
open indesignFiles
--Clear find text preferences
set find text preferences to nothing
--Clear change text preferences
set change text preferences to nothing
--establish properties for find
set find what of find text preferences to findWord
--establish properties for change
set change to of change text preferences to changeWord
--perform change text operation
tell document 1
change text
end tell
set find text preferences to nothing
set change text preferences to nothing
if modified of active document is true then
tell active document to save
end if
tell active document
export format PDF type to "Macintosh HD:Users:mattsocha:Desktop:Test1:test.pdf" without showing options
end tell
end tell