-
1. Re: Find/Change By List help
Jump_Over Oct 18, 2013 1:52 AM (in response to creusche)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
-
2. Re: Find/Change By List help
Salah Fadlabi Oct 18, 2013 2:42 AM (in response to Jump_Over)Also check:
A Major Job Gets Easier with GREP and FindChangeByList
http://indesignsecrets.com/a-major-job-gets-easier-with-grep-and-findchangebylist.php
-
-
4. Re: Find/Change By List help
creusche Oct 18, 2013 9:19 AM (in response to Jump_Over)Thanks Jarek,
I'm still unable to get it to work, but am wondering if it is because the .txt fil I wish to pull from is from a shared location on our network? Once I get the script to work I'd like to share it with other members of the team. So would where I save my .txt file affect the script.
mPath = "~/Documents/ID_words_to_find.txt",
The file I'd like to pull from is on our shared drive:
M:/Resources/Scripts and GREP Queries/ID_words_to_find.txt
Thanks!
-
5. Re: Find/Change By List help
Jump_Over Oct 18, 2013 9:32 AM (in response to creusche)Hi,
run this 1-liner in ESTK and watch console window. It will ask you for selecting a folder and its path will write in console. Just copy it and add a file name at the end.
mFolder = Folder.selectDialog();
Jarek
-
6. Re: Find/Change By List help
camilo umana Mar 29, 2014 9:56 AM (in response to Jump_Over)Jarek,
I was trying to use this script but it gives me an error 25 on line 18:
if ( !mOpen) {alert ("Can't open a source file"; exit()};
May be this used as a single script?
-
7. Re: Find/Change By List help
Jump_Over Mar 30, 2014 1:44 AM (in response to camilo umana)Hi,
It was a typo:
if ( !mOpen) {alert ("Can't open a source file"); exit()};sor
Jarek
-
-
9. Re: Find/Change By List help
Jump_Over Mar 30, 2014 4:44 AM (in response to camilo umana)Hi,
Exam your ID_words_to_find.txt contents. Should be comma delimited.
Try to find manually one of its content. I mean if your .txt contents is:
somethingToFind1,somethingToFind2,somethingToFind3
try to find in UI one of them. Is the result empty?
Jarek
-
-
-
12. Re: Re: Find/Change By List help
[Jongware] Nov 22, 2014 3:13 PM (in response to camilo umana)To change the Find Text options to "Whole Word", add after the first occurrence of this line
app.findTextPreferences = null;
(the one directly above Jarek's loop) this line
app.findChangeTextOptions.wholeWord = true;
About the accented characters: are they accented as well in your text file? This should work exactly as it does in the interface: "Find text" without accents will find text without the accents.
GREP is able to find 'any' kind of accent for common characters with this notation:
anam[[==u==]]
but that requires a re-write of the script.
-
13. Re: Re: Find/Change By List help
camilo umana Nov 23, 2014 1:16 AM (in response to [Jongware])@Jong
Thanks a lot (as always) for this fix.
(It was very that some phonemes were at the same time words in this language and the sample got contaminated..)
The script is now working perfectly.
Accented letters... also!: Theory and you were right.
Have a nice day.
@Jarek
Thanks again for this script.
Is a must in some jobs.







