find uppercase - change in lower

Adobe Community Professional ,
Jul 23, 2014

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;

TOPICS
Scripting

Views

682

Likes

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

find uppercase - change in lower

Adobe Community Professional ,
Jul 23, 2014

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;

TOPICS
Scripting

Views

683

Likes

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
Jul 23, 2014 0
Contributor ,
Jul 23, 2014

Copy link to clipboard

Copied

HI,

Take a look of this link:

Script to replace small caps that are typed as capital letters with non-capital letters (A =&gt; a, ...

the script made by Chinna

may be you can find what you want

John

Likes

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
Reply
Loading...
Jul 23, 2014 0
Contributor ,
Jul 23, 2014

Copy link to clipboard

Copied

if the script is what you want

can you give Chinna a correct,

don't give me, please

john

Likes

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
Reply
Loading...
Jul 23, 2014 0
Adobe Community Professional ,
Jul 23, 2014

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

Likes

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
Reply
Loading...
Jul 23, 2014 0
Enthusiast ,
Jul 23, 2014

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

Likes

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
Reply
Loading...
Jul 23, 2014 0
Adobe Community Professional ,
Jul 23, 2014

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

Likes

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
Reply
Loading...
Jul 23, 2014 0
Enthusiast ,
Jul 23, 2014

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

Likes

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
Reply
Loading...
Jul 23, 2014 0
Adobe Community Professional ,
Jul 23, 2014

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

Likes

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
Reply
Loading...
Jul 23, 2014 0
Enthusiast ,
Jul 23, 2014

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;

Likes

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
Reply
Loading...
Jul 23, 2014 0
Adobe Community Professional ,
Jul 23, 2014

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

Likes

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
Reply
Loading...
Jul 23, 2014 0
Enthusiast ,
Jul 23, 2014

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;

Likes

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
Reply
Loading...
Jul 23, 2014 0
Enthusiast ,
Jul 23, 2014

Copy link to clipboard

Copied

Hi premio_oscar,

script is working or not ?

if yes, mark as correct answer...

Vandy

Likes

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
Reply
Loading...
Jul 23, 2014 0
Adobe Community Professional ,
Jul 23, 2014

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!

Likes

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
Reply
Loading...
Jul 23, 2014 0
New Here ,
Nov 29, 2020

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

Likes

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
Reply
Loading...
Nov 29, 2020 0
Adobe Community Professional ,
Nov 29, 2020

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 )

Likes

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
Reply
Loading...
Nov 29, 2020 0