Style groups

Hello everyone,

I'm looking for a script (CS4 5.5) to create groups of styles (character and paragraph) place.

I n (not know how the script so please, if this text does not exist, explain step by step how to write it.)

Thank you!

I don't know exactly what you want.

This creates a new group of paragraph style:

var group = app.documents[0].paragraphStyleGroups.add();
group.name = "Rumplestilskin";

Substances

Tags: InDesign

Similar Questions

  • Move the style Group paragraph styles

    Hello

    I want to spend the paragraph styles of Group of paragraph style to the paragraph style palette.  I use the code to do so below.  Styles of the style group is moved outwards but on display inside the style group. All the elements of paragraph style are no name moved style return.  He took the last paragraph style in the style group.

    test (App.activeDocument.paragraphStyleGroups);

    Alert (app.activeDocument.paragraphStyles.length + "-" + app.activeDocument.paragraphStyles.everyItem () .name)

    function test (PPMs)

    {

    try {}

    for (var i = sGrp.length - 1; i > = 0; i--)

    {

    cstyleGrp = PRGS [i];

    for (var j = cstyleGrp.paragraphStyles.length - 1; j > = 0; j-)

    {

    var cstylGrpStyle = cstyleGrp.paragraphStyles [j];

    cstylGrpStyle.move (LocationOptions.AT_END, app.activeDocument.paragraphStyles [app.activeDocument.paragraphStyles.length - 1]);

    cstylGrpStyle.move (LocationOptions.AT_END, null);

    cstylGrpStyle.move (LocationOptions.AFTER, app.activeDocument.paragraphStyles [0]);

    }

    If (cstyleGrp.paragraphStyleGroups.Length > 0)

    {

    test (cstyleGrp.paragraphStyleGroups);

    }

    }

    } catch (e) {}

    }

    Screen shot 2015-07-07 at 2.02.08 PM.png

    Screen shot 2015-07-07 at 2.02.26 PM.png

    You can get the behavior very buggy if you aren't careful with moving paragraph styles!

    Either way, the right way to move from a paragraph style is like this (you will need to edit the code below as well as p becomes a reference to a real paragraph style):

    d = app.activeDocument;

    p = / * some paragraph style in a group of para-style * /.

    The following line move p in paragraph style out of his group and in the list of paragraph styles in the document d

    p.Move (LocationOptions.UNKNOWN, d);

    HTH

  • Delete paragraph styles in the style groups

    Hello!

    I have 30 + paragraph style groups that all contain the paragraph style "Fotobyline". Is there a way to remove this style in all groups of style with a script?

    Thanks in advance.

    Mikael home

    Try now,

    var doc = app.activeDocument;

    var pstyles = doc.paragraphStyleGroups;

    for (var i = 0; i)<>

    {

    If (pstyles [i].paragraphStyles.Item ("Fotobyline"). IsValid)

    {

    pstyles [i].paragraphStyles.Item ("Fotobyline"). Remove()

    }

    }

    Kind regards

    Cognet

  • How to delte empty the paragraph style palette Style group

    Hi guys,.

    I want to delete my folder empty paragraphStyleGroups that are the Style of Style group 1 and group 3 (see photo) of my palette.

    I need a code js for this task.

    I have created the script, but it removes all the Style of my Panel group.

    Here's the script:

    myDoc = app.activeDocument;

    myStyleGroup = myDoc.paragraphStyleGroups;

    for (p = 0; p < myStyleGroup.length; ++ p)

    myStyleGroup [p] .remove ();

    Picture 6.png

    Please suggest!


    Chang

    Here's another attempt:

    var styleGroup;
    var doc = app.activeDocument;
    var styleGroups = doc.paragraphStyleGroups;
    
    for (var p = styleGroups.length-1; p >= 0; p--) {
         ProcessGroups(styleGroups[p]);
    }
    
    function ProcessGroups(styleGroup) {
         if (styleGroup.allParagraphStyles.length == 0) {
              styleGroup.remove();
              return;
         }
         else if (styleGroup.paragraphStyleGroups.length > 0) {
              for (var g = styleGroup.paragraphStyleGroups.length-1; g >= 0; g--) {
                   ProcessGroups(styleGroup.paragraphStyleGroups[g]);
              }
         }
    }
    
  • Replace the language of the styles in the Style group

    Hi all

    Can anyone help to modify my script so it could also change the styles in the Style group. I tried several times by creating a loop nested under another variable for paragraphStyleGroups but I can't make it work.

    myDoc = app.activeDocument;

    myStyles = myDoc.paragraphStyles;

    myCStyles = myDoc.characterStyles;

    for (i = 1; i < myStyles.length; i ++)

    {

    myStyle = myStyles [i];

    myStyle.appliedLanguage = "Spanish";

    }

    for (i = 1; i < myCStyles.length; i ++)

    {

    myCStyle = myCStyles [i];

    myCStyle.appliedLanguage = "Spanish";

    }

    Your help will be appreciated.

    Thank you

    Kel

    Use allParagraphStyles and allCharacterStyles.

    myStyles = myDoc.allParagraphStyles;

    myCStyles = myDoc.allCharacterStyles;

    Shonky

  • [AS] [CS3] script find/repalace with style groups

    Hello world

    I've been struggling with this problem for a while and hope someone can enlighten us.

    I'm trying to use applescript to run a series of queries to search and replace.

    For example:

    Tell application "Adobe InDesign CS3"
    paragraph style applied to find the value of "Text" text preferences
    font style to find value text preferences 'italic book '.
    style character applied to change the value text preferences 'italic book '.
    tell document 1
    change the text
    tell the end
    tell the end

    This works great except if the document contains styles within groups of styles, in which case, I get an error saying

    "Adobe InDesign CS3 has been an error: invalid value for the set of"applied paragraph style"property."

    String, style section or anything, but received the "text". »

    If you do the find/replace manually, the paragraph style text (hand) indicating that the text is inside the hand of the style group.

    How can I specify it in the script?

    Thank you!

    InDesign is forgiving if you specify your style just in name, but in the case of groups of styles, be more specific.

    Tell application "Adobe InDesign CS4"

    -paragraph style applied to find the value of "Text" text preferences

    the value applied paragraph style to find text preferences for the paragraph style "Text" of the paragraph style group 'Hand' of the active document

    end say

    Dirk
  • [JS InDesign CS3] Style groups, Caprice in colors! (or: how to make the styles of paragraph and character off groups style?)

    Sorry for this question (and my terrible English, incidentally), I'm a javascript noob and I know when I reached my limits.

    Well, I'm taking a set of paragraph and character style groups styles, they are placed in hundreds of InDesign documents (which cannot be regarded as a book). As much as I've tried (thanks to the invaluable help of previous messages in this forum), I was able to move a style to a group and change its position within the group, inside root-level, or between the groups. But it is not matter how I try, I don't know which move reference should I try in case I want to take each style outside the style group and place them after their original level group, folder style [Root].

    I tried:

    var doc=app.activeDocument;
    var pGroups=doc.paragraphStyleGroups;
    
    for (i=pGroups.length-1; i>=0; i--){
         var pStylesInGroup=pGroups[i].paragraphStyles;
         for (j=pStylesInGroup.length-1; j>=0; j--){
    // Here I am, trying to move a style outside the folder that contains it, and failing miserably.
              pStylesInGroup[j].move (LocationOptions.after, pGroups[i]);
         }
    }
    

    He did not, the script has sent an invalid parameter value in the reference field, so I can't use the folder of the group itself as reference.

    Tried (obviously false) alternatives, such as the first available style using as reference. So my second script was

    var doc=app.activeDocument;
    var pStyles=doc.allParagraphStyles;
    var pGroups=doc.paragraphStyleGroups;
    
    for (i=pGroups.length-1; i>=0; i--){
         var pStylesInGroup=pGroups[i].paragraphStyles;
         for (j=pStylesInGroup.length-1; j>=0; j--){
    // Now I try placing the styles after the [Basic Paragraph], that is, the second paragraph style in the document style list 
              pStylesInGroup[j].move (LocationOptions.after, pStyles[1]);
         }
    }
    
    

    It did not work either, another invalid parameter in the reference field. Similar results with my other attempts (I even tried "[Root]" as literal with similar luck).

    So my question is: what command (or script, in case my approach is quite wrong) should I use to accomplish my goal?

    Thanks in advance to those who decide to spend more than a minute thinking about my humble worries and my apologies for some of your lines of code Ripper shamelessly for my purposes.

    Well, tried a few things and I really weird results!

    1. you can move a style within its group.

    2. you can move a style to one group "to" the other, but it will appear "inside" of this style. I got my style of test as a subdivision of [standard paragraph], using index #1. By the index 0 # InDesign ([no paragraph Style]) crashed.

    3. you can duplicate the style, but then you get a copy of the same group. Still no luck.

    4 finally! What is the parent of a paragraph style?

    Document | Request | ParagraphStyleGroup

    'Application' is easy - it's when you do a global style. So, what's the difference between 'Document' and 'paragraphStyleGroup '? Single - well, when you get finally he...

    pStylesInGroup[j].move (LocationOptions.AT_END, doc);
    

    move the style out of the Group and at the end of the list in the document. I don't think it's possible to move directly to a specific position in the main style list - you first need to move a group, then move it around in its own list.

    Fortunately, he returns his new position as a definition once again, if necessary, you can use

    newStyle = pStylesInGroup[j].move (LocationOptions.AT_END, doc);
    newStyle.move (LocationOptions.AFTER, pStyles[1]);
    

    -I haven't really tried this possibility, but it should work.

  • Remove groups of styles

    Hello! I have about 400 Indesign documents that have all of the 29 groups of paragraph style I need is no longer. Is there a way to delete these, as well as of their content, with a script? All style groups a group of corresponding character style that would be fine if it were to be deleted also.

    Greetings from Records,

    Mikael home

    Try this,

    var myInddFileList = File.openDialog ("Choose the InDesign files to remove Paragraph Style Group..." , "*.indd", true);
    for (var f = 0; f < myInddFileList.length; f++)
    {
        var myInddFile = app.open(File(myInddFileList[f]));
        var myDoc = app.activeDocument;
        var myParaGroup = ["paragroup1", "paragroup2"]; //mention your paragraph style group name here
        var myCharGroup = ["chargroup1", "chargroup2"]; //mention your character style group name here
    
        //Deleting the content of Paragraph Style Group
        for(i=0; i
    

    Vandy

  • How Referance groups paragraph Style in the Code?

    How reference to a paragraph in style Group before a paragraph style in the code? My "Heading 1" paragraph style is in a group, called "headings".

    myStyle = app.activeDocument.paragraphStyles.item("Heading 1");
    myStyle.appliedFont = "Microsoft JhengHei";
    
    

    Region Capture.png

    Richard:

    I build a large number of files Indesign containing the tag text, and this is an example of what I am at the beginning of the line when the style is located in a group.  The style name is "AGBoldCtr" and it is located in the group "xSports."

    American League

    In the code, I create a variable for a style to a group like this:

    var PPHead = app.activeDocument.paragraphStyleGroups.item("xSports").paragraphStyles.item ("AGPPHead");

    Then, I attribute PPHead variable of a paragraph as in:

    app.activeDocument.selection [0] .paragraphs [iLoop] .appliedParagraphStyle = PPHead;      //

    Dick Conrad

  • FindChangeByList script question, re: when a style is part of a group of style

    Hello

    I use script FindChangeByList InDesign and run into a problem.

    Here's the line of problem:

    grep {findWhat:"^."} {appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("Text").paragraphStyles.item("Body2.TextIndent"), changeConditionsMode:1919250519} {includeLockedStoriesForFind:false, includeLockedLayersForFind:false, includeHiddenLayers:false, includeMasterPages:false, includeFootnotes:true} //Change everything to Text.indent2 style

    What I'm trying to do, it's each paragraph in shape with the style called "Body2.TextIndent" which is in my style sheets in a group called "text".

    This line does not work for me; I get a JavaScript "Error #17.". Error string: the variable name expected. »

    Please note that I CAN get this line to work just fine if I use a style that is NOT in a group. For example, this line works very well for me:

    grep {findWhat:"^."} {appliedParagraphStyle:"Body2.TextIndent", changeConditionsMode:1919250519} {includeLockedStoriesForFind:false, includeLockedLayersForFind:false, includeHiddenLayers:false, includeMasterPages:false, includeFootnotes:true} //Change everything to Text.indent2 style

    The problem is apparently that the FindChangeByList script does not like style groups. I found it by internet Google and found this link:

    http://www.listsearch.com/InDesign/thread/index.Lasso?17986

    Can anyone help?

    Thank you.

    What version of InDesign are you using?

    The following line works for me on CS3, Mac.

    grep     {findWhat:"^."}     {appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("Text").paragraphStyles.item("Body2.TextIndent")}     {includeLockedStoriesForFind:false, includeLockedLayersForFind:false, includeHiddenLayers:false, includeMasterPages:false, includeFootnotes:true}     //Change everything to Text.indent2 style
    

    Kasyan

  • How quickly apply a style that is located in a group of style?

    I'm just trying apply a style to a table cell. Imagine myRow has been set for the row in the table, I work with, and My Fancy Style is the cell style that I created in my InDesign document.

    myRow.cells.item (0) .appliedCellStyle = "My Fancy Style."

    apply apparently this style quickly and without fuss. But now, if I created a style Group called fancy Styles through the InDesign user interface, and put my cell Style fancy inside, so I don't know any way to call directly as a string of text. It is possible somehow as:

    myRow.cells.item (0) .appliedCellStyle = "Styles of fantasy / My Fancy cell Style ';"

    of course I know does not work. I ask if there is a way as to make what I hope. Thank you!

    Why not just

    myStyle = app.documents [0].cellStyleGroups.item ("fancy Styles'). cellStyles.item ("Fancy cell Style");

    Peter

  • Remove styles of paragraph and character (keep substitutions)

    Hello

    Trying to write a script that will delete all the points and character Styles that are also included in the groups and keep overrides.

    So far:

    //Remove paragraphStyles
    var docs = app.documents.everyItem().getElements();  
    var dl = docs.length;  
    while (dl--)   
        {  
            var parStl = docs[dl].paragraphStyles.everyItem().getElements();  
            var pl = parStl.length;  
            while (pl--) if (parStl[pl].name != "[Basic Paragraph]" && parStl[pl].name != "[No Paragraph Style]") parStl[pl].remove();  
         }
    
    
    //Remove characterStyles
    var chs1 = myDoc.characterStyles.length;    
        for(var j=chs1-1; j>0; j--)
        {    
          myDoc.characterStyles[j].remove();    
        }
    

    After you change the code snippet to remove groups:

    main();
    function main(){
        var targetDoc = app.activeDocument;
        removeAllTypeStyles (targetDoc);
    }
    
    function removeAllTypeStyles (targetDoc) {
        //remove all paragraph styles
        for (var ps = targetDoc.allParagraphStyles.length - 1; ps >= 0; ps--) {
            if (targetDoc.allParagraphStyles[ps].name != "[No Paragraph Style]" && targetDoc.allParagraphStyles[ps].name != "[Basic Paragraph]") {
                targetDoc.allParagraphStyles[ps].remove (targetDoc.paragraphStyles.itemByName ("[No Paragraph Style]"));
            }
        }
        //remove all character styles
        for (var cs = targetDoc.allCharacterStyles.length - 1; cs >= 0; cs--) {
            if (targetDoc.allCharacterStyles[cs].name != "[None]") {
                targetDoc.allCharacterStyles[cs].remove (targetDoc.characterStyles.itemByName ("[None]"));
            }
        }
        //remove all paragraph style groups
        for (var pg = targetDoc.paragraphStyleGroups.length - 1; pg >= 0; pg--) {
            targetDoc.paragraphStyleGroups[pg].remove ();
        }
        //remove all character style groups
        for (var cg = targetDoc.characterStyleGroups.length - 1; cg >= 0; cg--) {
            targetDoc.characterStyleGroups[cg].remove ();
        }
    }
    
  • How can I move pages from one document to the other without merger of paragraph styles?

    I want to create a singular indesign file of 2 separate documents, which allows me to make an interactive PDF of it.

    However, when you move pages from one to the other, it seems that when each document has a paragraph style with the same name, they merge. The problem is that text is then adjusted if the styles do not match completely.

    Is there a way to merge the documents without any formatting changes?

    Create a Style group in each document and move all styles in this file. Give each document a different name. Do it with all kinds of styles: paragraph, character, objects, tables and Cell Styles. Then you can sort them later in the merged document what you do with these styles.

  • How to associate style para by script

    Hello

    My indesign file already has some style of band, when I try to take the XML in Indesign now same paragraph style are not automatically mapped with. FYI

    1.png

    Here the style 'TXT' is already defined in "Chapters" style group (see part A). After flowing again "TXT" (see part B) happens without mapping.

    Now I want to map the 'Part B' with 'Part A' style is possible by script?

    Hi Hasvi,

    Can the code below is useful, please test at your end.

    Vandy thanks...

    _mappingStyle("TXT", "Chapters", "TXT")
    _mappingStyle("TXT1", "Chapters", "TXT1")
    
    function _mappingStyle(findStyle, changeGroup, changeStyle)
    {
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.appliedParagraphStyle = findStyle;
        app.changeGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item(changeGroup).paragraphStyles.item(changeStyle);
        app.activeDocument.changeGrep();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        }
    

    Concerning

    Siraj

  • Implement 'Apply Style unless'

    Hello

    In web design you can create exceptions by saying: If something happens after, or nearby, to do this. IE (css): h1 + p {margin-top: 0px ;}}

    Is it possible to do it in InDesign?

    I want to give InDesign training: "Apple a paragraph before of 3mm except IF a paragraph style {'title'} ' I want a 'before' larger paragraph on the body of the text when it follows a paragraph in the same style and a narrower paragraph"before"when it follows a cap.

    Thank you

    Nope, InDesign does not have conditional styles. It would be very useful

    feature and you should consider filing a feature request.

    It should always do everything manually - define a separate paragraph

    for each difference in style and apply the styles to paragraph manually. Then

    you have a style called "Subtitle A" and another called "subtitle has."

    After the title of the chapter"etc etc.

    To help keep things under control, it is probably worth taking the time

    to create groups of style paragraph and the different, but related,.

    in their own paragraph styles group. But it is purely a

    organizational thing - it does in fact no additional functionality.

    Cut out the tedious process of having to go through all your

    document by applying right paragraph styles, I sell a script on my

    website (www.freelancebookdesign.com) called "changes".

    Paragraphs', that allows to say something like: "whenever the subtitle.

    is followed by the title of the chapter, replace the subtitle A with

    Sous-titre-A-suite-chapitre-titre"etc. It passes then through the

    document and made the necessary adjustments. Many people use this

    script to save hours of tedious work. Worth a visit if you

    do a lot of it, I think.

    Ariel

Maybe you are looking for

  • All in one Photosmart C410 opens the folder of the Windows computer

    The computer folder to open and view the forces of HP Photosmart All in One 410 hard, removable storage devices, and network placement.  This happens on the start and restart.  That's like if I went to the menu start, access the computer icon and ope

  • How to fix concetion with a friend on xbox live

    Impossible to reach a mincraft game for some reason friends any. How can I solve this problem?

  • Problems starting Windows Update now

    Hello I run windows vista 64 bit and have a motherboard ASUS striker ultimate with an ATI Radeon 4850 (also ASUS) and a processor intel 2.4 ghz quad core Q6600. Yesterday, I downloaded the optional updates and recommended to my system, at the end of

  • Install more memory RAM

    Hi, I just bought a Dell XSP 8900 and laid up in my Dell 8500 XSP.  My question is can I use RAM memory chips in my old 8500 in my new 8900?  Also, can I use the old hard drive and DVD drive? Thank you

  • How to contact A.T. Romero to say thank you?

    has been very useful and problem solved but I can't find any way to return to lending.EAS