Copy link to clipboard
Copied
Dear Community,
I am looking for a .js Script in InDesign that allows me search for a specific text. I haven't found a script yet that is working for me. I need this function for my text replacement project for further functions that allows me to replace the placeholder text in indesign with data from an excel-file.
At first, i only need the text finder function. In my example i have 5 textfields on my indesign page. In the first textfield is the text "product1", in the second "product2" and so on until "product5". Now i just need a script that finds these textphrases.
Thanks and kind regards
Luca
> At first, i only need the text finder function.
That's simple enough:
app.findTextPreferences = null;
app.findTextPreferences.findWhat = 'product1';
found = app.activeDocument.findText();
This returns an array of found text objects.
Copy link to clipboard
Copied
Can't you use DataMerge?
Copy link to clipboard
Copied
Hey Robert,
no. Datamerge uses templates. But each side is individual. I want to produce a catalog and datamerch is not an option.
Thank you anyways! 🙂
Copy link to clipboard
Copied
Hey Robert,
no. Datamerge uses templates. But each side is individual. I want to produce a catalog and datamerch is not an option.
Thank you anyways! 🙂
By @LucaKnoop
But technically speaking - your document is a template?
DataMerge is for producing Catalogues - unless your Catalogue is some special kind?
After script will find those 5x texts and update with the data - what next? What with the next record in your database?
Copy link to clipboard
Copied
each site looks different, has different amounts of products, Header Images and so on. Datamerch is for one template only.
Copy link to clipboard
Copied
each site looks different, has different amounts of products, Header Images and so on. Datamerch is for one template only.
By @LucaKnoop
Yeah, in that case you need a tool that will dynamically add extra rows to the table(s) or place extra icons in the same TextFrame.
But if you keep asking "one question at a time" - you won't get a good / complex advice / solution...
Will your catalogue be "hardcoded" - each product in a specicif place and won't move - or do you need ability to add / remove / move products?
Will each product be a single page / spread or as a smaller module - and multiple modules per page?
Copy link to clipboard
Copied
I was just asking for a simple text finding script.
Copy link to clipboard
Copied
Here is a script to try
Copy link to clipboard
Copied
> At first, i only need the text finder function.
That's simple enough:
app.findTextPreferences = null;
app.findTextPreferences.findWhat = 'product1';
found = app.activeDocument.findText();
This returns an array of found text objects.