I need to find & replace a string of text. I tried FindChangeByList script which it does work but I need to be batch over 300 ID documents. Open/ find/ replace/ save/ close)
I found this script & modified some lines but Im getting an error -10006 Can’t set object or data to object or data. I checked the dictionary but I am in blank (I’m not a scripter at all but I like applescript) After spending hours trying to figure it out by myself I have to throw the towel. I understand the concept. Please any guidance or tips will help me to make it work.
set OLDid to {"WRT11-TY"} -- set up the data lists to be exchanged --find this
set NEWid to {"WRT11-TYA"} -- replace with this
set source_folder to choose folder with prompt "Select folder containing InDesign docs" with multiple selections allowed without invisibles
tell application "Finder" to set item_list to (every item where name ends with "indd") of folder source_folder as alias list --only ID docs can be selected
tell application "Adobe InDesign CS4"
activate
repeat with DocAlias in item_list --(loops thru ID docs)
set doc to open DocAlias
tell document 1
repeat with swap from 1 to (number of items of OLDid) -- swap is the list index
set oldReference to item swap of OLDid -- Get an old ID...
set newReference to item swap of NEWid -- Get the corresponding new ID...
set find what of find text preferences to oldReference -- and load each string into the 'Find'
set change to of change text preferences to newReference -- and 'Change to' boxes of the Find/Change dialog box
set hitList to find text -- 'find text' creates a list of matching strings...
repeat with foundIt in hitList
change text -- and 'change text' swaps the 'find' text field with the 'Change to' text field in the Find/Change dialog box
end repeat -- Keep doing this until you run out of items in 'hitList'
end repeat -- Next 'find' string; next 'change to' string
end tell
close document 1 saving yes
end repeat
end tell