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

Grep search in book

Participant ,
Jul 18, 2022 Jul 18, 2022

Copy link to clipboard

Copied

Hi,

I have a book with 230 files in it and I wonder if it is possible to do a grep search in those files without open it.

My skill in scripting its quite low so here is my question ¿do i fight with the code to try it? or ¿is it better to drink a beer with my friends because it's not possible?

Thanks.

TOPICS
Scripting

Views

1.0K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Jul 19, 2022 Jul 19, 2022

It's not even possible to open 230 documents: InDesign lets you open about 115 documents. One way to go about it is to create a simple script to do the replacement in one document, then use that script in a batch-processor like https://creativepro.com/files/kahrel/indesign/batch_convert.html

P.

Votes

Translate

Translate
Community Expert ,
Jul 23, 2022 Jul 23, 2022

Copy link to clipboard

Copied

Below is the general flow for opening a book document and closing it. You don't need to open all files at once; just iterate one at a time. You'd need to incporate your GREP routines into the script, probably as a separate routine in the while loop. 

 

 

var bookContents = app.activeBook.bookContents;
var n = bookContents.length;
var d;
while (n--) {
    //skip docs with pending changes
    if (bookContents[n].status !== BookContentStatus.NORMAL) continue;
    //need to do your own GREP find change routine
    d = app.open(bookContents[n].fullName, false);
    d.changeGrep();
    d.close(SaveOptions.YES);
}

 

 

 

Votes

Translate

Translate

Report

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
Enthusiast ,
Dec 07, 2022 Dec 07, 2022

Copy link to clipboard

Copied

LATEST

@nicosh  I got around to adding character and paragraph styles. New update is live on my website. Have a look and see if that would work. All feedback is welcome. Thanks.

https://www.marspremedia.com/software/indesign/find-change-csv-multi-doc

 

William Campbell

Votes

Translate

Translate

Report

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