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

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

  • Why can't define paragraph ball in the standard paragraph style?

    I want to configure my standard paragraph style so that I can quickly apply the individual paragraphs balls - using MY favorite dashes - without having to create a new style to the paragraphs of the ball. I tried to change the settings of the standard paragraph, with no document open style, but he doesn't seem to accept my choice of dashes. First of all, I selected bullets and put a dash, but then the default paragraph with bullets. When I pass the ball setting back to "none" the only thing he keeps is the last setting that I chose for the tabs. (At the same time, which changes the default tab for all paragraphs setting.) But when I create a new doct and start a paragraph of the ball, the hyphens by default always a.25 /-.25 and any tab setting LOWER a.25 results in the updated first line indented for the tab setting, but the rest of the paragraph indented a.25. There seems to be no way to change default indentation for bullets without creating a new paragraph style. And usually I'm fine with that. But I thought that I would have a default Quick using the standard paragraph style. Am I missing something or is it just not possible?

    Here is a Visual/verbal screenshot to help explain:

    InDesign-Bullet-Problem.png

    Let's see if I understand differently from others. You want to apply bullets manually from time to time without having to select a new style, you would do this by pressing the button bulleted list in the Control Panel, and you want the settings for tabs and indents, other than the default. Is this correct?

    Far as I can tell there is no way to do it. You cannot configure the settings for the chips unless the text cursor is active or if you set a style, there is no way to set up the new default values. You don't want to not set parameters whenever you need a ball, then either you type the balls by hand, tab and insert a hyphen character here, which is actually a lot more work, or you go ahead and set up the style. You can access the list of style in the menu drop-down control panel, or you can add a keyboard shortcut to give you quick access, or press Ctrl (Cmd on Mac) + entry for quick access to apply and start typing the name of the style (almost as fast as a keyboard shortcut).

  • How to write the script to apply the character style?

    Hello

    I'm on a Macbook pro and without a numeric keypad, so I can't assign a shortcut to character styles. I heard a roundabout solution where you can assign a shortcut to a script that applies the character styles. Can anyone write this script?

    My character style is called "features"bold. "

    I am new to scripting, sorry if this is a stupid question.

    See you soon

    Hello

    1. save this code as a file inside your Script Panel folder .jsx

    2. apply a shortcut using the menu Edit: shortcuts...

    Option to choose:

    • suggest you choose an option 'background': 'Text', so you can use several shortcuts that are occupied in other contexts.
    #target indesign
    if (app.selection && app.selection[0].hasOwnProperty ("baselineShift") ) {
      var cName = "Features bold";
      var mCstyle = app.activeDocument.characterStyles.item(cName);
      if (mCstyle.isValid)
           app.selection[0].applyCharacterStyle(mCstyle);
      else
           alert ("CharStyle: " + cName + " not found");
      }
    else
      alert ("Some text supposed to be selected...");
    

    Jarek

  • How to duplicate a layer and then change the adjustment layer?

    This used to be easy to PS7, but he is evasive in CS4. Sometimes we need to duplicate a layer, then change the adjustment layer. For example, we may have selected a portion of an image and used the brightness contrast and then we need to create a new layer using the same section using selective correction. What we have done in the past, is to duplicate the layer, and then change the adjustment layer. Any ideas?

    Create your new adjustment layer. Option drag the mask layer on the new original setting, and then choose replace.

    Beware of the many similar masks:

    http://www.teddillard.com/2008/10/Geekzone-rosenholtz-Sanchez-effect.html

  • I changed my point of view screen to "maximize" and then changed back to normal and "applied" this change. The view on my screen moves back between the two.

    I went on 'Properties' and then changed the screen to "maximize" that was impossible to navigate.
    I then reset the command on the screen 'Normal' then 'Apply' and 'OK '. Now when I open Firefox it
    by default, the maximum size of the screen. No matter how many times I try to re - configure
    the size of display screen, the default browser to the Maximum size. Nothing works!

    You can check if you have a user.js file in the Firefox profile folder that affects the pref browser.sessionstore.resume_session_once true value.

    You can use this button to go to the Firefox profile folder:

    • Help > troubleshooting information > profile directory: see file (Linux: open the directory;) Mac: View in the Finder)

    See also:

  • When I have something to stick in wordpad and then change the text, I'll then on preview before printing and most of the time the whole document is not there.

    Original title: need help with wordpad problem

    When I have something to stick in wordpad and then change the text, I'll then on preview before printing and most of the time the whole document is not there. I double space between lines and all that is more than one page disappears. I tried all the different formats (no envelope, window envelope, etc.). How can I fix?

    Hello

    ·         What happens if you use another application to preview before printing?

    ·         You are able to print the document correctly, or you receive no error message when printing?

    You try to use Microsoft Word or Notepad to check if you face the same problem.

    First of all, I would like to check to see if print preview is working on a new empty document with only a word in it.

    If Yes, then the problem is the document.

    You may need to clear any formatting, that depends on where you copied from.

    Your rule of printer drivers print preview

  • Everytime I open the preferences file damaged and is Illustrator CC reset back to the default and then change among other keyboard shortcuts.

    Everytime I open the preferences file damaged and is Illustrator CC reset back to the default and then change among other keyboard shortcuts.

    Thank you

    Hello

    We have published a fix today that solves this problem of corrupted preferences. Go to the creative cloud application and download the patch CC 20151.1 (19.1.1)

    If you see not the patch in the creative Cloud application wait on or refresh cycle you can disconnect and connect to force refresh the list of available patches.

    Kind regards

    Ashutosh

    On behalf of the Illustrator engineering team

  • When I turn off my screen saver and then change my theme to display then I see my screensaver off icon to dedicated.

    Screen standby turn off problem

    Hi I have Windows 7 and when I turn off my screen saver and then change my display theme I see then my screen saver icon will go offshore for on.  I disable the screensaver again and then change the display theme and once again I see lit again screensaver icon. This computer is a non-Autonomous network computer.

    Hello

    I suggest to create a new user account that the user account can be altered, please follow the steps in method 2 in my previous post to do the same.
    I hope this helps.
  • Change the paragraphs found in the standard paragraph style?

    I have look here for about an hour and could not find a discussion for this.  I see where it clears the substitutions but not change Style all together.  Here's what I need help do.  If I left saying text 4 selected boxes, I want the power to change the standard paragraph to paragraph and character set to None style style. If there is already can a discussion that I missed in this regard you point me in that direction.  If this is not the case, can I please help with this.

    You can usetpk1982of script to change all the paragraphs of the standard paragraph. But if you only want the block of selected text, then you will need to adjust thescript to change paragraph styles in the selected text frames.

    basically replace line 2 by var allTFrames = app.selection;
    Also, if you need to clear character styles need to do before you change the paragraph style or character styles will be removed and the formatting will be left as a local override.  Your final script after that these changes would be:

    myDoc var = app.activeDocument;

    var myTFrames = app.selection;

    for (var i = 0; i)< mytframes.length;="" i++)="">

    var tFrame = myTFrames [i];

    pStory var = tFrame.parentStory;

    var allParas = pStory.paragraphs.everyItem ();

    pStory.characters.everyItem () .appliedCharacterStyle = app.activeDocument.characterStyles [0];

    allParas.appliedParagraphStyle = app.activeDocument.paragraphStyles [1];

    }

    Note: instead of simply replacing the 2 wire I also changed the name of the variable to reflect rather than leave it in the form allTFrames; and add line 7... Other than these two changes everything was the script of tpk1982

  • 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)

  • Universal laboratory standards paragraph styles

    Then... I'm trying to reformat a bunch of 'How-to' manual techniques and several of them must conform to UL battery chargers. Does anyone know if a paragraph style sheet Standard UL exist anywhere? I googled the shit out of it and found nothing. I know that height, that policies must be based on the UL standards, but I honestly don't know take a font which is registered in points and change it in millimeters or inches. I have a workaround, but it's a PITA.

    Any help would be appreciated!

    Thank you

    Beckie

    Beckie,

    Sorry, no, I don't regarding the size of the font. But I've seen and done UL documentation for electronics before. I used a style guide, but none where wasn't listed font sizes. That questions of the layout and format. I can't get to my desktop computer and a quick Google search turned up until I think it's a more recent version of the document that I used.

    http://ulstandards.ul.com/wp-content/uploads/2015/01/ULStyleManual_v1_2014.PDF

    Hope this is of use and/or someone another Vienna with more information.

    Mike

  • 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

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

Maybe you are looking for