[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.

Tags: InDesign

Similar Questions

  • CS3: need script to replace spaces with underscores in the paragraph and character style names

    Help! I am very new to scripting.

    I managed to find and tweak existing javascripts to search through all my paragraph styles to disable hyphenation and off balance the jagged lines, but I need help with this one.

    I work on Mac OS 10.4.11 using Indesign CS3.

    I need a script that will search all my paragraph and character styles in my open Active document and replace spaces by underscores.

    Can someone help me with this? It would be greatly appreciated!

    1. I don't know, but I think you can use all the regular GREP inside this function codes. Do not use the quotation marks around of the expression, use slashes! (Why? Just a curiosity of Javascript... maybe a hack that goes back to the gray mist of JS development...)

    This work should - but rather the code above, this is not tested:

    .. Replace (/ [-\ / ()-. _] + / g. '_');

    The GOLD group inbetween the brackets contain all the characters you want to replace with an underscore: the hyphen (this has to be the first character in the group, else it will be interpreted as a range of characters from each side!), space, slash (this one is 'special' inside the function replace JavaScript, so I think he needs to escape with a backslash)! in parentheses, a period (not sure if it should escape - into ordinary GREP, it's the wildcard character for any character, but maybe he loses his magic within a group of GOLD) and finally... the underscore character. Why?

    Well, this replacement string comes with a free bonus. Note the sign after the installment of GOLD +. This means that a whole sequence of these characters is replaced by a simple underscore: "it's / a - / test" will become "This_is_a_test". Adding the underscore line itself to the string of research means that it will also find the whole chain 'space space (stroke underscore)' in 'This style (_)' and, oh magic!, replace it immediately with a single underscore.

    Just FYI, the tiny "g" after the closing slash is abbreviation of 'global', i.e. at the global level, replacing in this string. replace the default values for a replacement only (why? see above...), and adding the 'g' ensures he keeps replacing until it is not find matches more.

    2 see point 1.

    3. uh, yes it's true, but you will need to check very carefully if nothing inside one of these basic models is substituted. You can apply a base style and add substitutions to make look like a subtitle, but that isn't making it a. And to the next paragraph, you can apply a base style and add substitutions to make it look like a paragraph of plain text (etc.). It's a signature of witness to bad formatting...

  • How to make the color of the sky, exactly the same thing in multiple images?

    How to make the color of the sky, exactly the same thing in multiple images?

    Bengt Nyman wrote:

    I'm not trying to replace the sky. I want to talk to a group of photos BIF where the percentages of red, green and blue in the sky varies from a few percent, but enough to disrupt continuity within the group. I like t would be able to use the percentages of color to one of the pictures and replicated in others.

    Because the brightness of the sky probably varies from image to image using percentages RGB will not work. What you can use are the values of a and b the laboratory values . Right-click in the inside of the develop module histogram and tick 'Show Lab Color values.' You can ignore the value of L, which is the value of Luminance or brightness. Adjust the blue sky s a b valueusing the Temp WB and sliders dyed until they are the same as your first reference image file. The value determines the color red/green balance if you use the Tint slider to correct the value. The b value determines the color yellow/blue balance if you use the slider Temp to correct its value.

    Remember that setting the base Panel WB with 'fixed' values of b for photos taken under lighting conditions different sky will be the color of the other objects in the image look incorrect (birds, trees, buildings, etc.). In this case, you will need to use the brush setting to paint in the region of the sky and then use its temperature sliders and tinted to change just the color of the sky.

    To be honest I don't know why you feel it's necessary. Maybe you can post two screenshots: 1) with the sky that they way you want to and 2) an image that you want to resolve to match.

  • How to adjust the spacing between paragraphs in InDesign?

    I remember earlier versions of InDesign, simply having a fit that would regulate the amount of space before or after a paragraph. What he did is just to accept the BACKSPACE as an end of paragraph and give the setting you choose, similar to the definition of the line spacing and it was as simple as that. I don't see any icon view setting the spacing of the paragraphs in InDesign now, even a search on the spacing of paragraphs a lot of tangent and complicated theories but nothing simple and direct. Is there a way to do this simply in the new versions of InDesign?

    Hi Ken,

    On the far left of your screen, you will see two icons - paragraph and character. At present, the character a is selected, then your control panel is showing options for this. If you click the icon of paragraph below, you will find the controls of spacing you want. It might be that you have a smaller screen as I do, because mine shows the character and paragraph options all the time.

    Don't pay attention to paragraph styles. You can format your paragraphs using the Control Panel, select some of your existing text and then make a new style of paragraph based on the selection. I know we all go styles and that they might take a bit of getting used to, but they will save you a lot of time in the long run.

    Good luck

    Malcolm

  • InCopy paragraph and character styles

    Have been upgraded from CS3 to CS5 and our editors have a ton of paragraph and character style pré-séries. I was wondering if there was a way to import these to InCopy CS3 to InCopy CS5. I searched for them in the program files and the folder of application but data had no chance of finding.

    Open paragraph styles menu and choose load all styles. Find the file that has these defined styles.

    Bob

  • Synchronization of the paragraph and character creative cloud styles

    Is it possible to add several styles of paragraph and character of a library of clouds to a doc ID? I can't find a way to add multiple styles at once, one at a time

    . Also, when you apply a style to the cloud, it gives me a name conflict, even if the 2 different styles have different names.

    These conflicts can come if you have styles based on another on and this is based on another, these styles are also imported and can cause conflicts.

  • Im trying to publish a document that I create on Indesign, but when I push producer Folio he takes me to the Adobe web page and tells me that I don't have a folio.  How can I fix?

    Im trying to publish a document that I create on Indesign, but when I push producer Folio he takes me to the Adobe web page and tells me that I don't have a folio.  How can I fix?

    Check if you have created a folio in offline mode (appears with the icon of the computer/processor) to Panel Builder Folio in InDesign?

    Or folio is created under a different account in Panel Builder Folio.

    If the Folio is Offline: connect on Folio Builder Panel using the producer identification information Folio, folio offline select and click Download. Now, you will get this folio in Folio Producer and would be available for the publication of too.

    For more information, see https://helpx.adobe.com/digital-publishing-suite/help/create-folios.html#folio_builder_pan el_overview

    If you are connected to the Panel Builder Folio under a different account: share folio with desired edition account, after the folio appears below the post account. Now, either you can publish or create a copy (to control properly), and then publish the copied folio. Digital Publishing Suite help | Creation of folios

  • I use Photoshop elements on Windows 8.1 12.  When I go in the Expert Mode to change the available toolbar is displayed in a single column and missing several tools which foreground and background color.  How to restore the original toolbar?

    I use Photoshop elements on Windows 8.1 12.  When I go in the Expert Mode to change the available toolbar is displayed in a single column and missing several tools which foreground and background color.  How to restore the original toolbar?

    Try to re - set preferences.

    Go to: Edit > preferences > general (menu Photoshop Elements on Mac)

    Click on the button Reset preferences on the next launch

  • Apply OverprintFill option for all paragraph and character Styles

    Hello

    How can I request an OverprintFill option in all of paragraph and character styles in javascript. See my code below

    jsx. Coding: -.

    var mypstyle = app.documents.item (0).paragraphStyles.everyItem () .getElements ();

    for (i = 0; i < mypstyle.length; i ++)

    {

    mypstyle [i] .overprintFill = true;

    }

    Alert ("Done")

    Just change the loop as below:

    var mypstyle = app.documents.item (0).paragraphStyles.everyItem () .getElements ();

    for (i = 1; i

    {

    mypstyle [i] .overprintFill = true;

    }

    Alert ("Done")

    Vandy

  • How to make the header background color or footer extend to the width of the browser?

    How to make the background color of the header or footer extend beyond the defined site? I would like the backround to extend to the width of the web browser of the user.

    Instructions to do this are included in creating a rectangle of width 100% which extends over the entire width of a browser window.

  • Add a suffix to all of paragraph and character styles.

    As the title suggests, first of all I would like to add a suffix to all of paragraph and character styles:

    Title 1 = position 1_p

    Bold_p = "BOLD"

    Also, if possible, replace the space with an underscore:

    Title 1 = Heading_1_p

    Chapter No. 1 = Chapter_Heading 1_p

    You're not sure if this need of a script or two?

    Any help would be fantastic.

    See you soon

    Or use code below to replace all spaces with "_".

    For the paragraph Styles:

    myStyles = myDoc.paragraphStyles;

    for (oneStyle = 2; oneStyle)<>

    {

    myStyles [oneStyle] .name = myStyles [oneStyle].name.replace (/ / g, '_') + "_p";

    }

    For character Styles:

    var mycStyleslen = myDoc.characterStyles.length;

    for (a = 1;

    {

    myDoc.characterStyles [a] .name = myDoc.characterStyles [a].name.replace (/ / g, '_') + "_p";

    }

    Shonky

  • Help about the paragraph and character styles scriptting

    Hi all

    I'm working on a project with many files, I change change on all styles of paragraph with multiple processes

    for ex, change the font for all styles of paragraph on all open documents

              var docs = app.documents;  
                     
              for (var d = docs.length-1; d >= 0; d--) {  
                      var doc=docs[d]; 
                      
    var pstyles = doc.allParagraphStyles;  
    for (var a = 1; a < pstyles.length; a++) {    
                              if (pstyles[a].appliedFont.name=="Arial\tBold")    
                                   pstyles[a].appliedFont = "Arial\tBold Italic";    
                         }
                     }
    

    but I found a text inside frames (the locked position) my find/replace a not to apply to this topic

    so, is there anyway to do this process for all chassis from locked position?

    or at least make the lock of the United Nations to all open documents, but I can only do this for the active doc

    app.activeDocument.pageItems.everyItem (.locked = false)

    Another thing, I tried to change it on all styles of character on the files and I wrote the code with my little knowledge script but it seems does not, any hint please?

              var docs = app.documents;  
                     
              for (var d = docs.length-1; d >= 0; d--) {  
                      var doc=docs[d]; 
                      
    var cstyles = doc.allCharacterStyles;  
    for (var a = 1; a < cstyles.length; a++) {    
                              if (cstyles[a].appliedFont.name=="Arial\tBold")    
                                   cstyles[a].appliedFont = "Arial\tBold Italic";  
                         }
    }
             }  
    

    Thanks in advance

    Maybe your consolidated text block... Try this

    docs var = app.documents.

    for (var docs.length - 1; d = d > = 0; d-) {}

    var doc = docs [d];

    var pgItems = doc.allPageItems;

    for (var a = 0;< pgitems.length;="" a++)="">

    If (pgItems [a] instanceof TextFrame) {}

    While (doc.groups.length > 0)

    doc.groups.everyItem () .ungroup ();

    pgItems [a] .locked = false;      }

    }

    }

  • 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 ();
        }
    }
    
  • Unformattable Indesign text - how to remove the spaces between paragraphs?

    I have a 95 page indesign document. I have a few unwanted spaces between paragraphs. I could not get rid of these spaces. I tried to replace the formatting, using the window styles to paragraph, but in this case indesign does not yet recognize the formatting. I put paragraphs in form to 0P0 before and after paragraphs, and yet space remains between some paragraphs. I'm going crazy!

    The problem lies in the text imported into strange formatt, but that was five years ago and I don't even have access to the original text to try to import once more. Perhaps because it is a document to Indesign c5 and c6 now I use?

    Any help appreciated with gratitude,

    Sam

    After checking the object applied to blocks of text style: text frame JWK it shows under text frame General Options/Vertical Justification/Align/Justify (Peter Spier mentioned above about this possibility). I would put this Align/Top. Also when you changed the paragraph to align on the grid he left some gaps on some pages. I have put that back in would line up on the starting grid. There will be a reshuffle of the text when you do. To check if everything looks as it should. Make a copy of the file and make your changes there just in case, and let us know how it goes.

  • How to make the current page menu item displayed in a different font color?

    Hello

    My menu bar works very well. The links I get the text to hover display the desired color. Now I want the item menu of the selected page show a third color.

    With live-code activated in Dreamweaver CS6, I can see the following code is generated by the dynamic menu:

    "< script type =" text/javascript"src="/CatalystScripts/Java_DynMenusSelectedCSS.js "> < / script > <!-dynamic output CSS menu start-> < div id ="cat_549633_divs"> < ul id ="nav_549633">< class li ="selected"> < a href =" / home.html "> home < /a > < /li >< li > < a href =" "/ leistungen.html" > Services < /a > < /li > < li > < a href = "/ uhrenservice.html" > Uhrenservice < /a > < /li " "> < li > < a href =" / versteigerungen.html "> Versteigerungen < /a > < /li > < li > < a href =" / diamanten.html "> Diamanten < /a > < /li > < li > < a href =" / ueber_uns.html "" > Uber each < /a > < /li > < li > < a href = "/ kontakt.html" > Kontakt < /a > < /li > < /ul > < / div > < script type = "text/javascript" > catSetSelectedCSSItem ('nav_549633'); < /script > <! - end of output CSS Dynamic Menu - >

    The .selected class is created in the first element of the list (home) because it is the current page.

    And here is my CSS:

    {#nav_549633}

    float: right;

    list-style-type: none;

    padding-top: 5px;

    }

    #nav_549633 li {}

    float: left;

    text-align: left;

    }

    #nav_549633 li a {}

    color: white;

    text-decoration: none;

    margin: 27px 0 0 0;

    font size: 13px;

    text-transform: uppercase;

    }

    #nav_549633 Li a: hover {}

    color: yellow;

    }

    {.selected

    color: Green;

    }

    The green font color does not appear. It is still white.

    In order to see if the class 'works"I tried a few other attributes that work!

    {.selected

    color: Green;

    padding: 20px

    background-color: blue;

    }

    In this case, the item appears as a blue box with 20px padding, just as expected - but the font color is always white.

    Can someone help me?

    Kind regards

    Herman

    Hello Ginoem50,

    Looking at your css looks like the selected class does not work because the li #nav_549633 one is more specific is the one who is listened to.

    change .selected li.selected a #nav_549633 and it should work.

    Hope this helps,

    Chad Smith | http://bcgurus.com/Business-Catalyst-Templates for only $7

Maybe you are looking for