How to capitalize first letter in a text box

Learn / Forums / General InDesign Topics / How to capitalize first letter in a text box

Viewing 13 reply threads
  • Author
    Posts
    • #101860

      Hi all. :-)
      I have a file from the client, more than 300 pages, full of graphics, and over each graphic I have many text boxes (description of some elements on the graphic). So, probably more than 1000 text boxes related to graphic content.
      Some text boxes are single word, some of them a sentence.
      Most of them contain first letter (of the sentence, or single word) non-capitalized, very few with capitalized first letter.
      Now the client want all text boxes with first letter capitalized.
      Any chance that I can do that?
      The idea is:
      – select text boxes I would like to change
      – if first letter in each text box is already capitalized – do nothing
      – If first letter in each text box in non-capitalized, then capitalize it
      – All this should be done ONLY for selected text boxes (cause some other parts should stay unchanged)
      If someone can give me some tip, it will be great.
      InDesign version: CS6
      Platform: Windows
      Sorry for my non-perfect English. :-)

      Cheers!

    • #101863

      Hi,

      Could you share screenshots (with hidden chars)?

      Best,
      Michel, from FRIdNGE

    • #101867

      Sure.
      Here you have a “table”, it is actually imported graphic with text boxes over cells.
      There’s no point to discuss the quality of their work – it is as it is, and there’s no point to recreate all tables, cause they don’t care about it.
      But, I should capitalize first letter in text boxes.
      One more time: sometimes it is not necessary, and sometimes it should stay non-capitalized, cause they covered with text box just the second part of the sentence (when, for example, first part is just the product number).
      So, it should work just on selected text frames.
      There are many variations, but I think this is a good sample.
      I intentionally left low resolution image preview for background graphic, so you can easily recognise the graphic.
      It is it Dutch, but that’s not relevant.
      https://postimg.org/image/mk6rho7ud/

    • #101869

      You said:

      “– All this should be done ONLY for selected text boxes (cause some other parts should stay unchanged)”

      Have you often these “some other parts”?

    • #101872

      As I said before, the shole document contains about 300 pages.
      I would say that for more than 200 pages everything is ok, mainly because these pages contain headlines, text, graphics/photos without text, etc. Document is created in a way tha text in not continuous, so each page is a separate text.
      The rest (about 100 pages) is a mix of text and graphics with text.
      Graphics are mostly in PDF imported into InDesign. All graphics are originally in English.
      Then, at some point, they made a decision to make Dutch version of the file, and they used text boxes in Dutch to cover existing English text, and that’s why document looks like wierd.
      Looks that during translation process with some CAT tool translator didn’t have access to PDF file as a reference, and, as as result, many times first letter is not capitalized.
      My guess is that I have close to 1000 text boxes where I must capitalize first letter.
      I’m working a long time in InDesign (since version CS2), I’m not a beginner, but my knowledge of scripting is slim to zero.
      Based on my knowledge, I’m not expecting fully automatic solution, cause I believe it’s not possible at all, but I’m trying to make my life just a little easier: instead of clicking each text box and manually change first letter to capital letter, to select all objects (that I must change) on the page, and then do some automatic magic, then go to the next page, to the same, etc.
      If I somehow manage that, I will save a lot of time, my guess is that I can do it 4-5 times faster.

      Btw, forgot to say, thank you for you answers.

      Cheers!

    • #101881
      David Blatner
      Keymaster

      You could make a character style that sets the text to All Caps, and then apply that style to just the first character of each paragraph with a Nested Style:

    • #101882

      Not sure, David! … And, imho, not so simple!

      When I read Sasha, I could think it could be done in 1 click!

      … Because Sasha talks about a new “Dutch” version based on an “English” one where guys have added small text frames to cover english text with dutch one!

      Maybe we just need to find the first one added in the doc! Logically, at the beginning of the doc and “loop” on the ID taking in account the “first one” ID!

      In this case, it’s just a simple find/replace!

      Clues:

      Find: “\A.”
      myFound[f].changecase (ChangecaseMode.uppercase);

      Best,
      Michel, from FRIdNGE
      [email protected]

    • #101883
      David Blatner
      Keymaster

      Michel, I don’t know how to script, so your clues don’t help me. I don’t think Sasha knows how to script, so it will not help her.

      I know you would use scripting for a solution, but if InDesign has a solution built-in, then I will always try that first. :-)

    • #101884

      David,

      I let you try!

      I’ld be curious to take a look to Sasha’s doc.! ;-)

    • #101886

      Unfortunately, I can’t give any part of the document, confidentiality agreement, even screenshot I sent wans’t the best idea.
      I was hoping that there is some simple solution, but if it itsn’t – doean’t matter, I’m ready to change everything manually.

      I must finish everything tomorrow (Central European time zone), so full working day (8 hours) should be enough to make 1000 changes, should be 2 changes per minute, can be done even with a lunch break. :-)

      And I think I should confirm that I have no idea how to make scripts. But I know how to use them. :-)
      Also, I don’t think that playing with styles will be the best option, cause there isn’t unique style for all text boxes, sometimes there is a different font face, sometimes different font size and/or font style…

      Whatever, thank you for your time, I appreciate it, relax and enjoy your day or night, wherever you are, I’ll finish this tomorrow.

      Cheers!

    • #101888

      Sasha, play this:

      var mySel = app.selection, S = mySel.length, s;
      for ( var s = 0; s < S; s++ ) mySel[s].characters[0].changecase (ChangecaseMode.uppercase);

      With this light version, you’ll just need to display spread [2 pages] per spread on the screen and select all the text frames [by clicking or sweeping] where you need to change the case of the first letter! Not the text, just text boxes!

      Best,
      Michel

    • #101889
      David Blatner
      Keymaster

      Wow… no styles?! That is a problem.
      Well here is one other option: you could use the GREP tab of the Find/Change dialog box

      This will find all the first characters of ALL your first stories (all text frames, and all table cells), and it will apply the “all caps” formatting to them.

    • #101892

      David,

      After test, I really think it could be done as I said above [but we’ll need 2 clicks! …] because we talk about 2 docs:
      English version vs. English version + text frames added for the dutch translation!

      So, imho, it’s simple:

      1/ Open the “English version” and play this:

      //————————————————————————————————————-

      var myTextFrames = app.activeDocument.textFrames.everyItem().getElements(),
      T = myTextFrames.length, t,
      myIDs = [];
      for ( var t = 0; t < T; t++ ) myIDs.push(myTextFrames[t].id);
      myIDs.sort(sortnum);
      function sortnum (a, b) {return a > b};

      alert (myIDs[T-1]);

      //————————————————————————————————————-

      This script will give us the bigger ID of text frame included into the English version InDesign file ==> XXXX. [close this file without saving it]

      2/ Then open the Dutch version and play this 2nd script modifying “XXXX” by the number given by the first script :

      //————————————————————————————————————-

      var myTextFrames = app.activeDocument.textFrames.everyItem().getElements(),
      T = myTextFrames.length, t;
      for ( var t = 0; t < T; t++ ) if ( myTextFrames[t].id > XXXX ) myTextFrames[t].characters[0].changecase (ChangecaseMode.uppercase);

      //————————————————————————————————————-

      Done! =D

      The 2nd script will only change the case of the first char of a text frame IF the ID of this text frame is bigger than XXXX!
      … More clearly, if that frame has been created later than the most recent text frame of the English version!

      Simply cool! …

      Good night!

      Michel, from FRIdNGE

    • #101905

      Just to let you know that everything is done – manually. :-)
      There was no chance that I take a risk and try to do something with a script, cause it might end up with 2-3 hours time lost, and I couldn’t afford it cause of delivery time, so I decide to go with the slowest, but the most safe option.

      Thank you one more time.

      Cheers!

Viewing 13 reply threads
  • You must be logged in to reply to this topic.
>