Copy link to clipboard
Copied
Hello to all,
i have bibliography which contains lot of names in uppercase.
Is there a script or grep to find all these words and change them in lowercase living only first letter in uppercase?
e.g.: MARC TWAIN > Marc Twain; G. ORSON WELLES > G. Orson Welles
I can find uppercase with grep "\u+" but I can't change them in lower case.
Thank you in advance
Try this,
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "\\u+";
finds = app.selection[0].findGrep();
for(var i=0;i<finds.length;i++){
finds.texts[0].changecase(ChangecaseMode.titlecase);
}
app.findGrepPreferences = app.changeGrepPreferences = null;
Copy link to clipboard
Copied
HI,
Take a look of this link:
the script made by Chinna
may be you can find what you want
John
Copy link to clipboard
Copied
if the script is what you want
can you give Chinna a correct,
don't give me, please
john
Copy link to clipboard
Copied
hello Johnwhite,
thank you for your answer.
I wrote a word in uppercase, in one new document, and I tried the script but nothing happens (i have indesign cs6, mac os x 10.6.8).
Probably I do something wrong
Thank you anyway
Copy link to clipboard
Copied
Please update your word in the array list, it will do the rest.
var array = ["MARC TWAIN", "ORSON WELLES"];//update your word here
Vandy
Copy link to clipboard
Copied
Hi vandy88,
I think I would lose a lot of time to put all the names in the script.
This is not a list of names but bibliography.
Thank you a lot anyway
Copy link to clipboard
Copied
Hope this will help you...
var array = ["MARC TWAIN", "ORSON WELLES"];
for(var j=0; j<array.length; j++)
{
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = array
finds = app.documents[0].findGrep();
for(var i=0;i<finds.length;i++){
finds.texts[0].changecase(ChangecaseMode.titlecase);
}
app.findGrepPreferences = app.changeGrepPreferences = null;
}
Vandy
Copy link to clipboard
Copied
Hello vandy88,
the names I wrote before (MARC TWAIN, ORSON WELLES) was only example.
In my document there are a hundreds different names that I should change to lower case
Thank you
Copy link to clipboard
Copied
Try this,
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "\\u+";
finds = app.documents[0].findGrep();
for(var i=0;i<finds.length;i++){
finds.texts[0].changecase(ChangecaseMode.titlecase);
}
app.findGrepPreferences = app.changeGrepPreferences = null;
Copy link to clipboard
Copied
Hi vandy88,
now your script is very good!
Could you make it work for just the selected text?
Thank you a lot
Copy link to clipboard
Copied
Try this,
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "\\u+";
finds = app.selection[0].findGrep();
for(var i=0;i<finds.length;i++){
finds.texts[0].changecase(ChangecaseMode.titlecase);
}
app.findGrepPreferences = app.changeGrepPreferences = null;
Copy link to clipboard
Copied
script is working or not ?
if yes, mark as correct answer...
Vandy
Copy link to clipboard
Copied
Hello vandy88
forgive me, I could not see before your answer.
Now I tried the script and it's great.
Thank you a lot!
Copy link to clipboard
Copied
how do I use that script you have sent @Johnwhite ?
I need find uppercase and replace to lowercase..
Indesign CC
Many thanks!
Kind Regards
Karel
Copy link to clipboard
Copied
Hi Karel,
the link in the reply of Johnwhite is not working anymore. Initially it linked to a thread in the old InDesign or InDesign Scripting Forum. Unfortunately that thread was not moved to this forum last year when the forum software switched from Jive to Khoros.
Instead you may look into this script by Peter Kahrel:
Change case
InDesign's GREP is powerful, but one feature it lacks is case conversion: you can't change the case of what your GREP expression matches. But this can be remedied by a script that acts as a kind of extension to the Find/Change dialog. …
https://creativepro.com/files/kahrel/indesign/grep_change_case.html
Regards,
Uwe Laubender
( ACP )