Copy link to clipboard
Copied
Is there a script of grep command to be able to change a first letter cap in a word to lowercase?
I'm working on a book of quotes and the attribute name/author of the quote has a first letter cap in both the first and last name. A style is being used for the author name, that calls for all small caps with no initial (larger) cap—we want the small caps to be one size and at the moment the initial letter of each name is retaining the capital letter. The text was imported from Word.
Did a search and it seems like people have struggled with this. I've used some Grep commands in the past but am really a novice at it. Thought I found a script that would do this, but it doesn't seem to work in ID 2018.
I had started to change some of the type manually, but there are over 100 quotes so seems like there should be a better way.
If anyone can direct me to a script or grep command that would be greatly appreciated. If you suggest a grep, please spell out how I use it.
Thanks
Jeff
Jeff,
Is there a script of grep command to be able to change a first letter cap in a word to lowercase?
This could be enough!
The short version:
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = "((\\b\\u\\l+\\b)\\h?){2,}";
app.findGrepPreferences.appliedCharacterStyle = "AuthorName";
myFound = app.activeDocument.findGrep();
for ( var f = 0; f < myFound.length; f++ ) myFound
.changecase(ChangecaseMode.LOWERCASE); app.findGrepPreferences = null;
Best,
Michel, for FRIdNGE
Copy link to clipboard
Copied
Can you post screenshots to show what you have and how you need it to look after...also some actual text (or link to INDD file) would be helpful. Seeing the text makes it easier to find the pattern that fits your document. GREP doesn't work in isolation and the rest of the document needs to be taken into account (or at least the rest of the paragraphs the text might live in).
Copy link to clipboard
Copied
Do the names always appear at the beginning of a line or anything consistent like that? You could find the first two words (obviously wouldn't work with authors with more that 2 names)...you can make all the found text lowercase, but you'll have to do it semi-manually. You could set up a keyboard shortcut for lowercase and use GREP to find the words that needed to be lowercase.
Copy link to clipboard
Copied
Is the font by any chance .otf format? OTF fonts with full character sets have the Small Caps option and also an All Small Caps option under OpenType:
This could be saved with a style:
If it's not an OTF font it could be scripted what OS are you using?
Copy link to clipboard
Copied
Jeff,
Is there a script of grep command to be able to change a first letter cap in a word to lowercase?
This could be enough!
The short version:
app.findGrepPreferences = null;
app.findGrepPreferences.findWhat = "((\\b\\u\\l+\\b)\\h?){2,}";
app.findGrepPreferences.appliedCharacterStyle = "AuthorName";
myFound = app.activeDocument.findGrep();
for ( var f = 0; f < myFound.length; f++ ) myFound
.changecase(ChangecaseMode.LOWERCASE); app.findGrepPreferences = null;
Best,
Michel, for FRIdNGE
Find more inspiration, events, and resources on the new Adobe Community
Explore Now