Free Script! Case Cycle script

Case Cycle Script for InDesign

Free download!

This little script is a great timesaver. It simply cycles through three of InDesign’s capitlization options: All caps, lowercase, sentence case.

Although InDesign lets you assign a separate shortcut to each of the options, I find that I miss the possibility of cycling through the options which I’m familiar with from Microsoft Word.

With this script you can simply place your cursor in or near a word, or select some words or letters, and hit the shortcut key you’ve assigned to the script. One press will turn the word from lowercase to Sentence case. Another press will turn it into TITLECASE. And another press and you’ll be back with lowercase.

Lowercase screeshotUppercase screenshotTitlecase screenshot

Sounds trivial, but in fact I use it dozens of times a day – especially when keyeing-in editor’s corrections.

Try it and see! It’s FREE!

Enjoy!

Click here to download the full script.

 

3 thoughts on “Free Script! Case Cycle script

  1. Excellent ! I was looking for this, since I am very used to this feature from MS Word… Thank you !

  2. Hey, I love the script it works well in CS5.
    I do however want to make use of the Sentence Case option too (there are 4 options in CS5, not sure about previous versions). How do I go about changing the code to make it work?

    Below is my hack attempt that simply replaced the Sentence case option for the Title Case option instead of adding as a fourth choice.

    //BS”D
    //ToggleCase
    //An InDesign CS4 script (c) Ariel Walden, 2011
    //Freebie script from http://www.FreelanceBookDesign.com
    try{
    mySelection = app.selection[0];
    if (mySelection instanceof InsertionPoint){
    if(mySelection.words[0].isValid) mySelection = mySelection.words[0];
    else{
    myIndex = mySelection.index;
    if (myIndex < mySelection.parent.insertionPoints[-1].index && mySelection.parent.insertionPoints[myIndex+1].words[0].isValid) mySelection = mySelection.parent.insertionPoints[myIndex+1].words[0];
    else {
    mySelection = mySelection.parent.insertionPoints[myIndex-1].words[0];
    }
    }
    }
    myText = mySelection.contents;
    if (myText != myText.toUpperCase() && myText != myText.toLowerCase()) mySelection.changecase(ChangecaseMode.UPPERCASE);
    if (myText == myText.toUpperCase()) mySelection.changecase(ChangecaseMode.LOWERCASE);
    if (myText == myText.toLowerCase()) mySelection.changecase(ChangecaseMode.SENTENCECASE);
    if (myText == myText.toSentenceCase()) mySelection.changecase(ChangecaseMode.TITLECASE);
    if (myText == mySelection.contents) mySelection.changecase(ChangecaseMode.UPPERCASE); //necessary because if lowercase letter in middle of word selected, changing to titlecase does nothing.
    }
    catch(f){}

    Regards,
    Dan.

  3. thanks a lot for u’r script…

Leave a Reply

Your email address will not be published. Required fields are marked *