Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Finding and highlighting from Excel

Community Beginner ,
Jan 06, 2022 Jan 06, 2022

So here is my dilemma and a BIG ASK!
I have a lot of documents (100s) that need company names removed from them that are in the text. Is there a script (plugin/something) that will search an Indesign document using the keywords (company names) from (for example an excel file) and highlight the text in the Indesign document where those words appear?

 

Open to other suggestions as well.

 

Thanks in advance.

TOPICS
Scripting
685
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 06, 2022 Jan 06, 2022

You want to highlight them or delete them.
How many compagny name you have?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 06, 2022 Jan 06, 2022

Hi Jean-Claude

I would say highlight them initially with a view to deleting. There are approx 200+ company names.

If I could search and highlight all in one go per document that is the aim

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 06, 2022 Jan 06, 2022

You could build a long query (with your 200 name), with underline custom format in change to, than save it.
Next you can use Peter Kahrel Script Grep Query Manager to run that query to a folder full of files.

GrepQueryManager > https://creativepro.com/files/kahrel/indesign/grep_query_manager.html

You can create you query that way, each comany name separaated by a pipe |

(?i)\b(cie1|cie2|cie3)\b

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 06, 2022 Jan 06, 2022

You can look at modifying the preinstalled FindChangeByList script. A breakdown of it is here: 

 

https://yourscriptdoctor.com/findchangebylist/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 06, 2022 Jan 06, 2022

That's an interesting one! I'll look at that and get my head around it. Thanks.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 06, 2022 Jan 06, 2022

Hi agree with @brian_p_dts - this is the way that I would approach it.

 

Can you please let us know if this resolves your issue?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2022 Jan 07, 2022

Modifying the FindChangeByList script is painful.
It will not allow the user to execute the query on 100 or more documents at once.

This is not the way to approach it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2022 Jan 07, 2022

Can be easily modified to operate on multiple docs/folder of docs. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 07, 2022 Jan 07, 2022

So how would I get the 100+ names that I need searched for into the script? Would I separate them with a pipe?

 

set myFindChangeList to {"text", {find what:"Company A | Company B"}, {change to:"assistance of their leaders"},

 

Haven't scripted before, but always willing to learn!

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2022 Jan 07, 2022

I woud just add the rest of the line of code to new columns in the Excel, then export as CSV. 

COL A: set myFindChangeList to {"text"

COL B: {find what: "company name"}

COL C: change to:"assistance of their leaders"

 

Necessary separator columns would be added by CSV. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2022 Jan 07, 2022

Here is how you would modigy FCBL to run on all docs in a selected folder, right around line 72. Run the script with no file open. 

else{
		var myFol = Folder.selectDialog("Choose a folder with the INDDs");
		if (!myFol || !myFol.exists) return;
		var allDocs = myFol.getFiles("*.indd");
		var tempDoc;
		for (var ad = 0; ad < allDocs.length; ad++) {
			try {
				tempDoc = app.open(allDocs[ad]);
				myFindChangeByList(app.documents.item(0));
				tempDoc.close(SaveOptions.YES)
			}
			catch(e) {}
		}
		//alert("No documents are open. Please open a document and try again.");
	}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2022 Jan 07, 2022

If it’s to be used with FindChangeList Script...
You need to edit the findChangeStrings.txt file not the script itself

If you use TEXT Search mode. One company for each line.

text {findWhat:"company1"} {changeTo:"assistance of their leaders"}
text {findWhat:"company2"} {changeTo:"assistance of their leaders"}
text {findWhat:"company3"} {changeTo:"assistance of their leaders"}
etc...

if using GREP search mode (multiple company can be wrote in a single line.

grep	{findWhat:"\\b(company1|company2|company3|etc..)\\b"}	{changeTo:"assistance of their leaders"}	




Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 07, 2022 Jan 07, 2022

Thank you @Jean-Claude Tremblay I will have a go at this and report back. Thank you all for your help and knowledge.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 06, 2022 Jan 06, 2022

Find and replace is the function. Find and replace with a character style.

There is a script delivered with and you can adapt it for your purpose.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2022 Jan 07, 2022

Remember that you will also need to have some way of scanning for the text in placed graphics. e.g. if you have an organizational chart created in llustrator, you can't search for that in InDesign.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 07, 2022 Jan 07, 2022

Good point Brad @ Roaring Mouse 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2022 Jan 07, 2022

You could also us Multi Find/Change extension to load a CSV directly. This is a paid extension but it worth all the 60$. Many others useful features.

https://www.automatication.com/product/mfc/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2022 Jan 07, 2022

And here another suggestion:
If you have a functional script* you can run it with Peter Kahrel's Batch Process script on open InDesign documents, on all InDesign documents of a specific folder or on all InDesign documents in a nested folder structure:

 

https://creativepro.com/files/kahrel/indesign/batch_convert.html

 

*scroll down to section:

Run a script

and read into the notes at "Important".

 

Regards,
Uwe Laubender

( ACP )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 14, 2022 Jan 14, 2022
LATEST

Thank you all. I'm still working on a solution.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines