Automatic case changing

Ask a Question related to Adobe Indesign Windows, Design and Development.

  1. #1

    Default Automatic case changing

    Does anyone know a way (have a script) for changing case according to
    character or paragraph style?

    I am importing a lot of text with headings in caps, and want to be able to
    change them to sentance case.

    k


    Ken_Grace@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. Changing text without changing frames.
      I have a small flash movie that is basically a color chooser. Rather than changing the color of an item by putting the color in a frame I change...
    2. case and functions
      Yo..... I read in Learning Perl that there are no such constructs like a case statement. Is there something similar or did I misread this? Also...
    3. #23026 [Com]: Make Zend case-sensitive (classes, functions, remove case-insensitive)
      ID: 23026 Comment by: nvivo at mandic dot com dot br Reported By: mfischer@php.net Status: Open Bug Type: ...
    4. Changing case of the first letter of words in string
      I want to make the case of the first letter of all the words in a selected string to upper case. The code s/\b(\w+)/\u$1\E/g; enables me to do...
    5. Case Sensitive
      I did the following: 1. create table amit (name varchar(10) not null Primary key) 2. insert into amit values ('a') 3. select * from amit 4....
  3. #2

    Default Re: Automatic case changing

    Here you go:

    if (app.documents.length != 0) {
    myDoc = app.activeDocument;
    myStyles = ["Head","Subhead"];
    app.findPreferences = null;
    app.changePreferences = null;
    for (i=0; myStyles.length>i; i++) {
    try {
    myStyle = myDoc.paragraphStyles.item(myStyles[i]);
    myStyle.name;
    }catch(e){
    // Ignore missing styles
    continue;
    }
    myFinds = myDoc.search("",false,false,undefined,{appliedPara graphStyle:myStyle});
    for (j=0; myFinds.length>j; j++) {
    myFinds[j].changecase(ChangecaseMode.sentencecase);
    }
    }
    }

    Just replace or add style names to the third line. The script ignores any style names that are not present in the document.

    Dave
    Dave_Saunders@adobeforums.com Guest

  4. #3

    Default Re: Automatic case changing

    Brilliant. Thanks Dave. I'll remember this script (!).

    k


    Ken_Grace@adobeforums.com Guest

  5. #4

    Default Re: Automatic case changing

    I guess I should take some steps to make sure I do. I just banged it out so at the moment this is the only place it exists.

    Dave
    Dave_Saunders@adobeforums.com Guest

  6. #5

    Default Re: Automatic case changing

    I would think it quite useful in a wider context, like on Exchange. What
    would make it really user friendly would be to add an input box with a drop
    down of paragraph/character styles in the document, story/document/selection
    wide selection and the change case options.

    What, of course, would ultimately be neater would be if Adobe were to put
    change case options in find/replace.

    Thanks again Dave, that's going to save me a lot of time.

    k


    Ken_Grace@adobeforums.com Guest

  7. #6

    Default Re: Automatic case changing

    And then there's the concepts of "smart" sentence case and "smart" title case where selected words can be listed for exceptional treatment (remain all-caps in the first case; go to all lowercase in the second).

    Perhaps, rather than a dialog box, if the script took instructions from an editable text file. I don't like dialog boxes if I can help them, but I also don't like having to tell people to edit scripts in order to use them.

    Not that I have anything against the Exchange, but I'm assembling a page of useful utitlities on my web site. I'll work up a more useful version of this script and add it. The page is here: Informal Utilities for Download <http://pdsassoc.com/index.php?Nav=downssub&Ban=InformalUtilitiesForDow nload&Info=downloads/index.php>.

    Dave
    Dave_Saunders@adobeforums.com Guest

  8. #7

    Default Re: Automatic case changing

    Dave,

    Is that saved as a .js javascript textfile?

    Thanks,

    Mike Witherell in Washington DC
    mikewitherell_at_jetsetcom_dot_net Guest

  9. #8

    Default Re: Automatic case changing

    Mike,

    Yes.

    Help me brainstorm. How about a text file that looks like this:

    Paragraph Styles
    name1
    name2

    Character Styles
    name1
    name2

    Internal Caps
    InDesign
    PageMaker
    McDonald's

    Lowercase Exceptions
    and
    by
    with
    for
    etc.

    Uppercase Exceptions
    BBC
    IBM
    etc.

    This file would sit in the same folder as the smart case changer -- except I'm inclined to think I need two script: smart Title case and smart Sentence case.

    Each script would work like this:

    If you have a text selection then the script ignores the style names and does its thing on the selection, applying the other lists as appropriate.

    If you have no names listed under the styles, then it will complain if there is no selection. But if you have names there and no text selection, it will apply its changes to the designated styles, if they are used in your document.

    What if you have a text frame selected? How about a single insertion point?

    For the former, I could apply the style changes to only the text frame (or to its parent story). For the later, the style changes could be applied to the parent story.

    Perhaps in this odd-ball cases, the script should check with the user before doing anything or there could even be a check with user directive in the text file.

    What do you think?

    Dave
    Dave_Saunders@adobeforums.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139