23 Replies Latest reply on Mar 15, 2014 11:17 AM by Obi-wan Kenobi

    Paragraph StyleIs with Default text?

    techzol Level 1

      Is there a way, maybe by script, to have a paragraph style include some default text?

       

      For example, if I assign an empty paragrahp the Note style, It would display as formated, but would include the string "NOTE:"^t (i.e. NOTE: with a tab character following).

       

      or perhaps the style Caution might display as formatted with the word caution in all caps underline (CAUTION) followed by a forced line break (^n).

       

      Is something like this possible?

        • 1. Re: Paragraph StyleIs with Default text?
          BobLevine MVP & Adobe Community Professional

          Why do you need this? If it’s just for reference, check the story editor.

          • 2. Re: Paragraph StyleIs with Default text?
            Peter Spier Most Valuable Participant (Moderator)

            Not as part of a style, but you can do it with Find/Change.

             

            Find: ^. and set the find formatting to the paragraph style you want to add the text in.

             

            Change: [whatever the text is that you want to add] $0  (without the brackets, unless you want them to appear).

             

            You can use Peter Kahrel's script to chain multiple queries: A GREP query manager

            • 3. Re: Paragraph StyleIs with Default text?
              techzol Level 1

              These are frequently used styles that always start with the same initial word and formatting. Just thought it would be nice if it could save me some oft-repeated keystrokes, character formatting, etc.

              • 4. Re: Paragraph StyleIs with Default text?
                techzol Level 1

                Peter,

                 

                Thanks. I knew that. See my reply to Bob.

                 

                Marc

                • 5. Re: Paragraph StyleIs with Default text?
                  Peter Spier Most Valuable Participant (Moderator)

                  Setting up the find/cahnge queries  might be time consuming, but once done, running the script can be done in a flash. If you don't want to wait until the very end you'd probably need to add a negative lookahead to the find string to be sure the first word isn't already there.

                   

                  But there are other possibilities, like setting up some autocorrect entries that would complete the first word, or some scripts that could be run froom a keyboard shortcut that would assign a paragraph style and add the word(s) at the same time.

                  • 6. Re: Paragraph StyleIs with Default text?
                    [Jongware] Most Valuable Participant

                    techzol wrote:

                     

                    Is there a way, maybe by script, to have a paragraph style include some default text?

                     

                    For example, if I assign an empty paragrahp the Note style, It would display as formated, but would include the string "NOTE:"^t (i.e. NOTE: with a tab character following).

                     

                    Use a Bullet List of type "Numbers". Enter your text "Note^t" in the field where you are expected to enter the number text code. To assign some default formatting, create a character style and select that in the drop down immediately under the text field.

                     

                     

                    or perhaps the style Caution might display as formatted with the word caution in all caps underline (CAUTION) followed by a forced line break (^n).

                     

                    Formatting is no problem, but the text field seems not to accept the forced line break. So for this one you need to use another solution.

                    • 7. Re: Paragraph StyleIs with Default text?
                      Peter Spier Most Valuable Participant (Moderator)

                      If I didn't hate working with lists quite so much I bet I'd finally remember this trick...

                      • 8. Re: Paragraph StyleIs with Default text?
                        Obi-wan Kenobi Adobe Community Professional

                        Hi Marc,

                         

                        I often use this feature. For that, I use QuicKeys.

                         

                        For example, I want to insert before a paragraph B another paragraph A with only this line: "WARNING:"

                        For that, I create a shortcut in Quickeys that, when, eg, I place the insertion point in the paragraph B, goes to the beginning of this paragraph and simply creates a new paragraph with the good style (A) that includes the numbering; "WARNING:".

                         

                        As this QuicKeys "shorcut" can be associated to a keyboard shorcut, it is very easy to manage the problem in ID.

                        • 9. Re: Paragraph StyleIs with Default text?
                          techzol Level 1

                          Hadn't thought of this. I gotta give it a try. Will let you know if it works. For all of the others of you who tossed in ideas, thanks. They were all helpful.

                          • 10. Re: Paragraph StyleIs with Default text?
                            [Jongware] Most Valuable Participant

                            Peter Spier wrote:

                             

                            If I didn't hate working with lists quite so much I bet I'd finally remember this trick...

                             

                            Agreed! Somehow Adobe managed to remove the usual usefulness of autonumbered lists and made it ... just a bit too complicated / cumbersome / not-doing-what-you-meant function. Usually a stickler for Styles, I cannot bring myself to create four or five styles just to have a double-indented list with some space above and below, and two levels of bullets.

                             

                            Also: what's with the Character Style choice not applying the character style!? I said above

                             

                            Jongware wrote:

                             

                            Formatting is no problem ...

                             

                            and lo and behold, I barely said so when I realized that the blasted thing does not show Underline, no matter how much I fiddle with its settings. Sure, I could use a Paragraph Rule ... but why doesn't it simply work as advertised?

                             

                            From the online help:

                             

                             

                            Choose a character style for the expression. (The style you choose applies to the entire number expression, not just to the number.)

                             

                             

                            -- and it does not list specifically which properties are applied and which ones are ignored for any reason.

                            • 11. Re: Paragraph StyleIs with Default text?
                              techzol Level 1

                              Just found out the same thing. Jongware has an inspired idea but, as he correctly pointed out, there does not seem to be a way to do a forced line break and, like you, I can't find a way to get it to underline. But, Jongware, thanks for the great clue!

                              • 12. Re: Paragraph StyleIs with Default text?
                                techzol Level 1

                                Sorry to be slow in responding, Ob-wan, but what are Quick Keys?

                                • 13. Re: Paragraph StyleIs with Default text?
                                  Obi-wan Kenobi Adobe Community Professional

                                  I think line break is not too important since ID introduces the "solidarity with previous" feature and this problem is totally bypassed by QuicKeys.

                                  • 14. Re: Paragraph StyleIs with Default text?
                                    Obi-wan Kenobi Adobe Community Professional

                                    QuicKeys is a little soft I use since its creation a long time ago. You can very quickly create little actions to fix a lot of problems like yours.

                                    • 15. Re: Paragraph StyleIs with Default text?
                                      Obi-wan Kenobi Adobe Community Professional

                                      Marc,

                                       

                                      For example, with QK, I place the mouse cursor into the paragraph I want to treat.

                                       

                                      I only have to play in ID the keyboard shorcut I associate to the QK shorcut I create.

                                       

                                      Cmd-shift-F1

                                       

                                      It launches the QK little script that, automatically and alone, makes the steps below:

                                       

                                      Cmd-up arrow // put the cursor at the beginning of the paragraph.

                                      carriage return // create an empty paragraph above this paragraph.

                                      up-arrow // to go to the new paragraph.

                                      Cmd-1 // it is the shorcut I apply to the para style I create, with the auto-numbering: CAUTION) - no need to make a line break even if it can be done by QK (no interest here).

                                       

                                      The QK action is almost instantaneous and, more, a "loop" can be written to treat the problem in batch (with a keyboard shorcut).

                                       

                                      QuicKeys is very simple to use and it is a great (and cheap!) faithful assistant. 

                                      • 16. Re: Paragraph StyleIs with Default text?
                                        rob day Adobe Community Professional & MVP

                                        It can be scripted with a few lines. If you are using OSX this Applescript will replace the selection with "NOTES" and a tab using the Basic Paragraph style just replace "[Basic Paragraph]" with "YourStyle".

                                         

                                        Scripts can be assigned key commands, so you could make as many variations as needed with keys assigned.

                                         

                                        =========================

                                         

                                        tell application "Adobe InDesign CS6"

                                            try

                                                set t to "NOTES" & tab

                                                set s to paragraph style "[Basic Paragraph]" of active document

                                                set properties of selection of active document to {applied paragraph style:s, contents:t}

                                            end try

                                        end tell

                                         

                                        =============================

                                         

                                        For the CAUTION example change set t to "NOTES" & tab to:

                                         

                                        set t to "CAUTION" & return

                                         

                                        You can include the underline in the style sheet

                                        • 17. Re: Paragraph StyleIs with Default text?
                                          Obi-wan Kenobi Adobe Community Professional

                                          Hi Rob,

                                           

                                          I totally agree, even if everyone is not able to write [AS] or [JS]. 

                                          • 18. Re: Paragraph StyleIs with Default text?
                                            Willi Adelberger Most Valuable Participant

                                            It is possible to set up a numbered list without numbers but a text instead. This text is written before the normal text of the paragraph where this paragraph style is applied. You can style this text with a character style.

                                            ExampleList.png

                                            • 19. Re: Paragraph StyleIs with Default text?
                                              rob day Adobe Community Professional & MVP

                                              It's too bad Quickeys hasn't been upgraded for a few years. It looks like it's no longer being developed—the Toolbars feature broke  after Snow Leopard.

                                              • 20. Re: Paragraph StyleIs with Default text?
                                                Obi-wan Kenobi Adobe Community Professional

                                                Rob,

                                                 

                                                I use the 4.0.7 version of QK under Mavericks and I have no worries. Still, I use it as a complement of [AS] and [JS].

                                                • 21. Re: Paragraph StyleIs with Default text?
                                                  Obi-wan Kenobi Adobe Community Professional

                                                  Hi Willi,

                                                   

                                                  Totally!

                                                   

                                                  Another example with "Caution". Only one paragraph with Caution (Color + small caps + underlined + line break) made with auto-numbering.

                                                   

                                                  Capture d’écran 2014-03-15 à 19.31.58.png

                                                  Capture d’écran 2014-03-15 à 19.33.34.png

                                                   

                                                  If you want to have "Caution:" above all the "X" styled paragraphs (in blue small caps, partially underlined with a "line break"), launch this regex:

                                                   

                                                  Search:  ^(?-m).

                                                  Replace:  \t$0

                                                  Search format: "X" para style

                                                  Replace by format:  "Caution" para style

                                                   

                                                  It is an example.

                                                  • 22. Re: Paragraph StyleIs with Default text?
                                                    rob day Adobe Community Professional & MVP

                                                    Do toolbars work for you? I used to use toolbars as a script launcher from the finder, but they no longer work. I can build a toolbar but the buttons don't work.

                                                    • 23. Re: Paragraph StyleIs with Default text?
                                                      Obi-wan Kenobi Adobe Community Professional

                                                      I see.

                                                       

                                                      I don't use it too because it does not work fine as you say!

                                                       

                                                      But it's not important for what i do with QK.