Skip to main content
Inspiring
May 3, 2016
Answered

Make a words Sentence Case?

  • May 3, 2016
  • 1 reply
  • 2003 views

Hi i'm making a script to change all the main changes that we do in a document.  I'm sure that grep will handle this but again i'm trying to combine about 6 different functions into one script.  How would i go about changing 2 lines of text into sentence case? The Top line would need changed and the Bottom 2 would need changed to sentence case.  Is there a way to add this grep string into my script? 

The Title Case Works Here "This is the only line that can be left alond"

The Sentence Case Works Needs Changed Here

The Sentence Case Works Needs Changed Here

This topic has been closed for replies.

1 reply

cbishop01Author
Inspiring
May 3, 2016

Here's my script so far.  WHere the Grep style changes is i would like to use all the grep styles i have in indesign.  Or if possible certain ones. the replace will have a ton more by the time i;m done but again the Grep is what i really need help with.

//DESCRIPTION: Running changes.

//Replace("<CR>", "Return") 

//~  Created by Chris Bishop - (5-3-16)  

    Replace(" <CR> ", "^p") 

    Replace("  ", " ")

    Replace(" :", ":")

    Replace(" .", ".")

    Replace("^p^p", "^p")

    Replace(" <CR>", "^p")

  

        function Replace(input, output) 

        { 

            app.selection[0]; 

            app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing; 

            app.findTextPreferences.findWhat = input; 

            app.changeTextPreferences.changeTo = output; 

            app.activeDocument.changeText(); 

          

        } 

//~     Grep Style Changes

//~  THe alert message shown when running this script. 

try{ 

    do { 

      

        myText.pointSize = myText.pointSize - .01; 

        } while (myTextFrame.overflows == true); 

    } 

catch(e){ 

    alert("Text already Formatted") 

cbishop01Author
Inspiring
May 4, 2016

THank you i'll check these out.