Skip to main content
New Participant
October 17, 2013
Question

Find/Change By List help

  • October 17, 2013
  • 1 reply
  • 12325 views

Hi all,

New to scripts here using InDesign CS6.

I need some help on how to set up the find/change by list script in InDesign. I searched the forums but I don't quite grasp if I need my list saved as a .txt file or something else and where to save the list.

I have a list of about 50 words (text only) (and growing) I'd like to simply find these words in my document, but not change them to anything as I need to rewrite the content to fit.

I'm hoping there is a find next of some sort with this script so I can search the entire set of terms in one shot. (I played with the Multi/Find change script (http://automatication.com/) but it looks like that requires me to "change all" rather than find all)

When I run the script in indesign it asks me to select a file to pull from. I currently have my list of text setup in a .txt file. (But not knowing code, I'm wondering if I need to save this text file differently or code it so the find/changebylist script can pull from this file)

Could someone point me in the right direction, or let me know if this is the correct script to use and how to use it?

I noticed in my script panel the find/change support folder (C:\Program Files (x86)\Adobe\Adobe InDesign CS6\Scripts\ mentioned on this site is missing from my folder.)
http://colecandoo.wordpress.com/2011/08/25/make-findchange-behave-more-like-a-word-macro/

Thanks for your help. Hopefully I get the hang of this soon.

This topic has been closed for replies.

1 reply

Jump_Over
Brainiac
October 18, 2013

Hi,

You can go straight or try to modify 'MultiFind' script.

I suggest to use a text conditions and go straight with this code:

var

          mDoc = app.activeDocument,

          mCond = mDoc.conditions.item("mFound"),

          mPath = "~/Documents/ID_words_to_find.txt",

          mDelimiter = ",",

          mSource = File(mPath),

          mOpen = mSource.open("r",undefined,undefined),

          len, len1, mWordsArr, mFound;

if (!mCond.isValid)

          mCond = mDoc.conditions.add({

                    name: "mFound",

                    indicatorColor: UIColors.LIGHT_BLUE,

                    indicatorMethod: ConditionIndicatorMethod.USE_HIGHLIGHT,

                    underlineIndicatorAppearance: ConditionUnderlineIndicatorAppearance.SOLID

                    });

if ( !mOpen) {alert ("Can't open a source file"; exit()};

mWordsArr = mSource.read().split(mDelimiter);

len = mWordsArr.length;

app.findTextPreferences = null;

while (len-->0) {

          app.findTextPreferences.findWhat = mWordsArr[len];

          mFound = mDoc.findText();

          len1 = mFound.length;

          while (len1-->0)

                    mFound[len1].appliedConditions = [mCond];

          }

app.findTextPreferences = null;

How it works (should)?

Assumed:

- a list of words to find is in a .txt file as comma-delimited (you could set other delimiter)

- this file is named 'ID_words_to_find'  and saved in user Documents folder (you can change mPath)

Script define a condition 'mFound' and apply it to every word from your list found in a document. They are highlighted. You can modify them.

Notice: to remove a condition (highlight) modify a word including a space before it.

Enjoy:)

Jarek

Salah Fadlabi
Inspiring
October 18, 2013

Also check:

A Major Job Gets Easier with GREP and FindChangeByList

http://indesignsecrets.com/a-major-job-gets-easier-with-grep-and-findchangebylist.php

Brainiac
October 18, 2013