For moderators: This thread should be placed into "InDesign Scripting" forum!
You don't really need a script to do all of this.
1. To globally "replace" a name or some other text, make it a Text Variable.
2. To globally replace a set of images, do the following:
a. Put all of the variable images inside a folder of their own.
b. For variants, create a new folder for each and put the variant images in this. Make sure the filenames match those in the other folder (and, ideally, their file type and size).
c. To quickly swap the images, Relink your images to this new folder.
Thanks for this. Yes it's really easy to Find & Replace text and relink to folders so they automatically update all same-named links, but the issue is that we're anticipating quite a lot of variations in a short timeframe so to save doing this document by document myself, I'm ideally looking to write a script to do this process automatically by itself many times over, depending on data that's put in. Ideally opening the document, doing the changes, Saving As and exporting as PDF, then moving onto the next version of the document.
The input data would be in an identical format (order form), probably in an email inbox, but have a different name, hair colour, eye colour etc.
Moving to InDesign Scripting