Auto create paragraph styles and properties

Dear all

I had created two styles of paragraph helps with script below. Now, I put all the properties in H1 (as basic character formats (police, font size, leading, monitoring, kerning, indent and spacing, tabs, paragraph rules, keep the option and all of the paragraph style Options).) It is possible to fix. I will totally have creat 60 to 70 styles.

Thanks in advance

The code is:

var doc = app.activeDocument;

var array = ["H1", "H2"];

for (var i = 0; i < array.length; i ++)

{

try {}

doc.paragraphStyles.add({name:array[i]});)

}

catch (e)

{

Alert ("'" + array [i] + "'" + "already exists in the document.")

}

}

Thank you

ASHRAM

Hi ASHRAM.

It works very well here. Try again.

var doc = app.activeDocument;

var array = ["H1", "H2"];

for (var i = 0; i)<>

{

try {}

If (array [i] == "H1") {}

doc.paragraphStyles.add ({name: array [i], appliedFont: 'Arial', pointSize:12, attack: 15});

}

If (array [i] == "H2") {}

doc.paragraphStyles.add ({name: array [i], appliedFont: "Servant", pointSize:10, attack: 12});

}

}

catch (e)

{

Alert ("'" + array [i] + "'" + "already exists in the document.")

}

}

Kind regards

Cognet

Tags: InDesign

Similar Questions

  • I need help to write a script that detects the first instance of a paragraph style and then change

    I need help to write a script that detects the first instance of a paragraph style and then he goes to a different paragraph style.  I don't necessarily need someone to write all this, by the biggest problem is to find how to find just the first instance of the paragraph style.  Any help would be greatly appreciated, thank you!

    Hello

    then try this with your active doc:

    ....................

    myDoc var = app.activeDocument;

    mStyle var = myDoc.paragraphStyles.item ("PS_NameToFind"); change the name to paraStyle

    var mStyle_1 = myDoc.paragraphStyles.item ("PS_NameToChange"); change the name to paraStyle

    var mFrames = myDoc.pages.everyItem ().textFrames.everyItem () .getElements ();

    app.findTextPreferences = null;

    app.findTextPreferences.appliedParagraphStyle = mStyle;

    for (var k = 0; k)< mframes.length;="">

    {

    currFound = mFrames [k] .findText ();

    If (currFound.length > 0)

    currFound [0] .paragraphs [0] .appliedParagraphStyle = mStyle_1;

    }

    app.findTextPreferences = null;

    ................

    Rgds

  • script to duplicate the standard paragraph style, and then change the size of the character point

    I want to create a script that will create a cascade of paragraph based on the style settings [standard paragraph] styles. My goal is to point size of each new paragraph style character as a percentage of the original [standard paragraph]. So if [standard paragraph] is 100% (point character size 10pt), the script would create a paragraph style called 120% ' that has a point size of character of 12 points. Then 133%, 140%, and on and on. I modified a script found on this forum to generate these new styles, but I don't know how to be based on the [standard paragraph]. Any help would be much appreciated, thanks in advance.

    current script:

    var doc = app.activeDocument,

    pStyle = ['100% ', '120% ', '133% '];

    for (var i = 0; i < pstyle.length; i ++)

    {

    If (pstyle [i] is "100 %")

    {

    doc.paragraphStyles.add ({name: pstyle [i], appliedFont: 'Deer', pointSize:10});})

    }

    ElseIf (pstyle [i] == "120 %")

    {

    doc.paragraphStyles.add ({name: pstyle [i], appliedFont: "Deer", pointSize:10 * 1,2})

    }

    ElseIf (pstyle [i] == "133 %")

    {

    doc.paragraphStyles.add ({name: pstyle [i], appliedFont: "Deer", pointSize:10 * 1.33333})

    }

    }

    Try this,

    var doc = app.activeDocument,
        pstyle = ["100%", "120%", "133%" ];
    
    for(var i =0;i
    

    Kind regards

    Cognet

  • [JS IDCS5] Create paragraph styles tags

    Hello

    I want to iterate al paragraph styles in a document to create the tags there. The tags should have the same name as the paragraph styles. Is this possible and how?

    Best regards, Sjoerd

    Hi Serjod,

    You can try the following JS code, I hope that you expect at this!

    var myDoc = app.activeDocument;
    var myPStyle = myDoc.paragraphStyles;
    //var myAllPStyle = myDoc.allParagraphStyles; if you want this enable a line all the folder paragraph styles also consider
    for (i=2; i
    

    THX

    csm_phil

  • List of paragraph styles and formatting

    Does anyone know of a script that will create a list of paragraph styles in a document and all the specifications of formatting to the paragraph styles? If not, is there a third-party utility available that would list for example?

    I'm looking for something for InDesign that has a similar function to the plug-in for Adobe FrameMaker, called paragraph tools, manufactured by Silicon Prairie Software.

    Text Styles journalist Dave Saunders does just that:

    http://pdsassoc.com/index.php?NAV=downssub&ban=InformalUtilitiesForDownload&info=downloads index.php

    He said he was for CS2, but it works at least in CS3.

    Noel

  • Impossible to format document with several paragraph styles and notes

    I'm working on a document where I have several text boxes on the same page. The text boxes reflect implemented different paragraph styles so that they will autopopulate in my table of contents. However, I need to add notes to this document. I find that the notes are at the end of the text box to which they apply to, and if I had to put a note in two different text boxes on the same page, both start at 1.

    Is it possible to manage notes in several text boxes? Or, if not, is it possible that I can attach my table of contents for the styles of characters instead of paragraph styles?

    Thank you!

    Looking at your screen shot in post #2, I see no reason to require individual images. You can manage every bit of this formatting in a unique setting using the styles section to control alignment, and dashes.

  • Search the text of paragraph style and place them in the new text block with width 50mm

    Hello

    I'm looking for voor a paragraph to find script dat styles and place them in a new text block with width 50 mm.

    Is there a solution?

    Kind regards

    Patrick

    Width: options General of the frame of the text, GBA: fixed width, then 50mm width

    Height: automatic block text size options

    (These two in the dialog box object styles)

  • best judgment for paragraph styles, object styles and character styles

    I want to learn the criteria difference and use of paragraph styles, object styles and character styles. I know how to use them, but know about the best judgment and context, when you use would be better. Can anyone recommend links? I've been using adobe. Please don't suggest books.

    Paragraph styles are whole paragraphs.

    Character styles are letters or isolated words. Do not use the long of an entire paragraph. Do not set all the attributes, only those who are different for the properties of the paragraph Style. Unlike Quark Xpress, in InDesign are character Styles used only for the difference of isolated words.

    Paragraph styles can include the character automatically Style: Styles, GREP, nested Styles, initial letters, chips automatic & numbers and line styles.

    Object styles , set the frame of the object. They include separate definitions of all of the object, the stroke and fill.

    Object styles can also be applied to images in a frame and groups.

    Object styles may also include in the following paragraph Style and a style of paragraphs in automatic way.

    Object styles have several categories, you can choose which category is relevant to apply. For example, it is possible to apply the first style object to give the stroke and fill and apply a different object style to format the corners only and then apply the next. (With this method last only the applied object Style is linked).

    Styles of the opportunity to make global changes in a document. If you build in a smart way, they are a huge time saver. They can be stored in the CC libraries or libraries with objects that are applied to them. If you have created once these styles, you can use them again, and with one or two clicks, you can make their own to new document.

    My recommendation: the habit of Styles, name them always with the same names that it helps you to be accustomed to them and to work faster, much faster.

    There are more models: Table Styles, Styles of cell, the Master Pages and color chart.

  • Problems with character and paragraph styles!

    Hello

    I have a problem to inDesign that I don't normally.

    (I work on a macbook pro)

    I'm adding a text in a template document. I have two character styles and the paragraphstyles.

    This is how I work:

    I place my text I have the text box. (placing a word document) First I get all of the italicized words in the text placed and they give a character style: italic. Then, I want to give a definition to the whole text. It is a 'regular' from the same font of type version. When I do that, all of the text get this pink-ish marking meens that the text has not been completely changed the style AND a little plus (+) next to the paragraph style accurs. Normally I just press alternative (alt) as I click the paragraph style and thus cancels the problem. BUT when I do that now all the text becomes italic - witch is not in the selected paragraph style. Why?

    I'm really lost how can I solve this problem - I don't want to create a new document because it is a model that I use each month for a magazine and normally it works.

    Would be - this code in the word document? Or what?

    Thank you!

    best,

    Sara

    Create your paragraph style

    Paste your text

    Run the Script PrepText

    http://InDesignSecrets.com/free-scripts-help-fix-Word-formatting.php

    This will apply/create character styles etc. italic, bold in all the text that you pasted in this text.

    Select all of your text - and click the clear button the replacements at the bottom of the paragraph Style Panel.

    Simple and fast

  • Create the style of the selected text paragraph?

    I am trying to create a paragraph style for the selected text in InDesign CS6 (Mac). There must be a simple command for this.

    For example, if I'm in the form of text which has no style paragraph and decide I want to save the formatting as a new style to apply it elsewhere, there is no command for 'create the new style of paragraph selected text'. The only option, seems, is to manually create a new paragraph style, click the style, which of course annihilates all the formatting desired, redo all the formitting (assuming a rememebers it), then right click on the paragraph style and hope that the option "Redefine a Style" is available (which is not often).

    Any guidance greatly appreciated.

    1 Select the text or keep blink, position the cursor on the text and the paragraph open style (press F11), on the paragraph style Panel, click the menu and choose new paragraph Style

    2. in this new paragraph Style dialog box, you can make your desire setting and check the box 'Apply the Style to selection'

    OR

    1. create your text of desire and click on this text created (or select the text) and click on create a new style button that is shown on the image

    2. When you click on create new style from the paragraph style list a paragraph style 1 is displayed but it will not be highlighted, it will highlight on the default style 'Standard paragraph', just click once on the style of paragraph 1 and double-click to rename.

    It will allow to keep the style of what you have created.

    Thank you

  • How to create a numbered list paragraph style?

    You know what you would think it would be simple to make a numbered list paragraph style.  I created a new paragraph. style is then in the bullets and numbers on the style. Here, I chose dial. When I applied it in 11 paragraphs each begins with 1.

    If I go to the toolbar at the top and click numbered list market then it works as expected. My style of "Numbered list", and then has a +, 'Redefining the Style' is grey so I can redefine to try to fix it.

    What I am doing wrong?

    BTW, I also want to use a style of tank inside it for the first line, which is the main point of the ball being made (small caps/bold) < paragraph return > then, normal text for the rest of this bullet

    Thank you

    You are also asked to do the first line "BOLD". You indicate that it is its own paragraph, so you'll want a paragraph style that includes character attributes and the attributes of type numbered list while you're there. You use character styles only if there is more than one style in the paragraph which is not the case here. And then create a paragraph style second which is indented and non-bold for text "complementary." If you skillfully use the tags 'next paragraph style', you can have styles replacing automatically as you type, then you can apply styles to an entire list with a single command using the context menu command "style Apply, then next style." So, in short, I would use three paragraph styles:

    1 FirstNumberedList style (resets the paragraph style counter next is number 1, "BOLD", "Description")

    Style of description (withdrawal, non-fat, is paragraph style following "NumberedList").

    2 NumberedList style (continue the numbering, "BOLD", is style of following "Description" paragraph)

    Style (even before) description

    3 NumberedList style (the same as before)

    Style description... etc.

    To apply all the styles on a typical previously part of the text in one: select the entire list, and then Ctrl-click on the 'FirstNumberedList' style in the palette paragraph styles, and then choose "Apply"FirstNumberedList"then next Style." The first paragraph will be in the FirstNumberedList format, and all of the following in your choice will have a format based on the "next paragraph style" of the previous paragraph.

  • text styles and paragraph autoflowing

    Hello forumers

    If I do my own paragraph style and the want to add what it all my pages, how can be done at the same time?

    Im trying to do, but I can only apply the paragrahp style to a 2page spread at once, not entire pages of the page 1-page 30

    Thank you.

    Styles are applied to the text, not pages. Don't we cover last week?

    You can select all the text in any subject, even if it is in excess or on another Board, then apply your style. You'll have to make each story independently, however. For new features, select the style with no selected text and it will become the default.

  • bullets and paragraph styles

    I can't make a list bullet when spacing is identical between the balls but tighter between the lines in the same ball.  I would try to put it in a paragraph style and not manually change the leader because that makes all lines changes

    Leader must be defined for line spacing of paragraph intra, then add space befor or sapce after the paragraph style to add more space between the balls. You may need a second style for the first or the last ball to get the correct space above and below the list.

  • created in Chapter 1 paragraph styles cannot be chosen for the other chapters

    HI. Now I have all my "paragraph styles" determined for my ebook. Thanks again for the advice saved me after that I lost so much time.

    New > book > book1

    New > doc > click

    Add > doc > Table of contents for book1 [which is the table of contents in the print version]

    Add > doc > Chapter 1

    Click table of contents to make master and select it.

    layout > toc [add paragraph styles used in chapter1] save the style as tocbook1 [deselected replace existing toc]

    Click on + to add next chapter 2 [this is now selected and I can see all the paragraph styles]

    - but when I double click to open Chapter 2

    -only ' standard paragraph + ", 'normal' 'reference text' and 'paragraph 1' style are available."

    more information:

    as I entered in each of the chapters in this book with a good table of contents (finally)

    -I can't select text > paragraph style > and see p-styles listed in Chapter1: chapterheading, chaptersubdescription, chaptersubtitle, paragraphspacing, dialogue...

    notes that can be useful with this diagnosis:

    I came across a major messup of "loading" styles p "all".  It sounded like a good idea.  It worked again but this time I just load them all rather than things deselection.  I don't have an idea of what I've done here, but

    result: all my notes were listed in the TOC navigation panel resulting in the .epub that was readable in adobe reader digital.

    what I ended up doing:

    After experimenting a ton - I was still unable to fix this problem which postponed in each table of contents that I tried to build from scratch, so I was just remove almost all "indesign books', indesigndocs that have been tocs and epub files.

    AGAIN, any help would be greatly appreciated.  I'm ready to roll if you know what I mean.

    Thank you

    I don't understand what you're trying to do.

    You say that you did not have your paragraph styles in the rest of your chapters?

    They are like this:

    Book1

    Chapter 1 (this does have styles p)

    Chapter 2 (it doesn't)

    Chapter 3 (does not)

    If this is the case then you must synchronize all what you styles p.

    Do this, use in designating what chapter to take information from by clicking on the first chapter in the small box left in the book window and then click the drop down menu on the window of your book

    go to the stync options select styles p and c

    then book Sync, this will fill the remaining chapters with the styles that are in the first chapter.

    you will need to open each chapter separately and apply the relevant styles to the paragraphs.

  • import the grep styles in more than a paragraph style

    Hello

    First of all, I must say that I have no experience in scripting. I do not create scripts, simply use the.

    I have a script that imports a paragraph style grep styles to another (in the same document). Whenever I use it, I have to change the script, captures the source paragraph styles and target in this piece of code:

    source = "origem";

    target = "alvo";

    What happens is that sometimes I need to do this lots of times (especially when the updating of old projects). Is it possible to import styles grep for more than a paragraph at the same time, listing multiple targets?

    Thank you!

    Sorry,

    the variable 'source' changed during execution of the script old th. Don't have a close enough look...

    Please replace:

    function setGrepStyle(){
    var target = arguments[0].toString();
    error = "";
     basePStyle = theDoc.paragraphStyles.item(source);
    if (!basePStyle.isValid) error = 'Source style does not exist';
     var target = theDoc.paragraphStyles.itemByName(target);
     if (!target.isValid) error += '\rTarget style does not exist';
     if (error != ""){alert (error); exit()}
      gs = basePStyle.nestedGrepStyles;
     for (i = 0; i < gs.length; i++)
            target.nestedGrepStyles.add (gs[i].properties);
            }
    

    Work here, if this does not work on your machine, I'll write a new piece to add to the SNA nestedGrepStyles ship off the doScript is not really necessary...

Maybe you are looking for