Script to duplicate Basic Paragraph style, then change character point size

I'm looking to create a script that will create a cascade of paragraph styles based on the [Basic Paragraph] style settings. My goal is for each new paragraph style's character point size to be a percentage of the original [Basic Paragraph]'s. So if [Basic Paragraph] is 100% (character point size 10pt), the script would create a paragraph style named '120%' that has a character point size of 12pt. Then 133%, 140%, so on and on. I modified a script found on this forum to generate those new styles, but I don't know how to create them to be basedOn the [Basic Paragraph]. Any help would be very 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] == "100%") 
            doc.paragraphStyles.add({name:pstyle[i], appliedFont:"Stag", pointSize:10});              
        else if(pstyle[i] == "120%") 
            doc.paragraphStyles.add({name:pstyle[i], appliedFont:"Stag", pointSize:10*1.2})              
        else if(pstyle[i] == "133%") 
            doc.paragraphStyles.add({name:pstyle[i], appliedFont:"Stag", pointSize:10*1.33333})              

Try this,
var doc = app.activeDocument, 
    pstyle = ["100%", "120%", "133%" ]; 
for(var i =0;i<pstyle.length;i++) 
        if(pstyle[i] == "100%")
            doc.paragraphStyles.add({name:pstyle[i], basedOn: doc.paragraphStyles[1], appliedFont:"Minion Pro", pointSize:10});             
        else if(pstyle[i] == "120%")
            doc.paragraphStyles.add({name:pstyle[i], basedOn: doc.paragraphStyles[1], appliedFont:"Minion Pro", pointSize:10*12})             
        else if(pstyle[i] == "133%")
            doc.paragraphStyles.add({name:pstyle[i], basedOn: doc.paragraphStyles[1], appliedFont:"Minion Pro", pointSize:10*1.33333})             
Vandy

Similar Messages

  • [Basic Paragraph] style name change to NormalParagraphStyle?

    i m trying to edit existing paragraph style. i was do it through kEditTextStyleCmdBoss. My problem is : As the command is process the name of [Basic Paragraph] style is changed to NormalParagraphStyle and it is now editable. How i can make its name field again not changable(i.e. preserve its original property)?
    Regards
    Kannu

    Hi,
    Have you some solution?
    Best regards:
    Karoly

  • [JS CS3] Find/Change "[Basic Paragraph]" style

    I'm trying to find all occurances of the [Basic Paragraph] style and replace them with [No Paragraph Style]. I'm using:
    app.findTextPreferences.appliedParagraphStyle = "[Basic Paragraph Style]";
    app.changeTextPreferences.appliedParagraphStyle = "[No Paragraph Style]";
    I get the message "Invalid value for set property 'appliedParagraphStyle'. Expected String, ParagraphStyle or NothingEnum enumerator, but received "[Basic Paragraph Style]"."
    I've tried every combination of brackets, no brackets, quotes, no quotes, etc. It doesn't seem like this can be scripted, even though it can be done via find/change in InDesign. Am I banging my head against the wall? Does anyone know if this can be done?

    "[Basic Paragraph]" as shown in the code below doesn't work either. (the word "Style" actually snuck in as I was trying different variations. But no combination seems to work.
    If anyone knows that [Basic Paragraph] can or cannot be accessed via scripting, I'd like to know. Thanks.
    app.findTextPreferences.appliedParagraphStyle = "[Basic Paragraph]";
    app.changeTextPreferences.appliedParagraphStyle = "[No Paragraph Style]";

  • Why can't I define bullet paragraph in Basic Paragraph style?

    I would like to set up my Basic Paragraph style so that I can quickly apply bullets to individual paragraphs - using MY preferred indents - without having to create a new style for the bullet paragraphs. I tried changing the settings of the Basic Paragraph style, with no documents open, but it doesn't seem to want to accept my choice of indents. First I selected bullets and set an indent, but then the whole paragraph defaults to bullets. When I switch the bullet setting back to "none" the only thing that it keeps is the last setting I chose for tabs. (Which simultaneously changes the default tab setting for all paragraphs.) But when I create a new doct and start a bullet paragraph, the indents always default to .25/-.25, and any tab setting LESS than .25 results in the first line indenting to the tab setting, but the rest of the paragraph indenting to .25. There seems to be no way to change the default indent for bullets without creating a new paragraph style. And usually I'm fine with that. But I thought I would like to have a quick default using the Basic Paragraph style. Am I missing something or is this just not possible?
    Here is a visual/verbal screenshot to help explain:

    Let's see if I understand this differently from the others. You want to apply bullets manually from time to time without having to select a new style, you want to do this by pressing the bulleted list button in the Control panel, and you want settings for tabs and indents other than the default. Is that correct?
    As far as I can tell there is no way currently to do this. You cannot set up the parameters for bullets unless the text cursor is active or you are defining a style, so there is no way to set up new defaults. You don't want to set up parameteres everytime you need a bullet, so, either you type the bullets manually, tab and insert an indent to here character, which is actually a lot more work, or you go ahead and set up the style. You can access the style list in the dropdown on the Control panel, or you can add a keyboard shortcut to give you quick access, or hit Ctrl (Cmd on Mac) + Enter to access Quick apply and start typing the name of the style (almost as fast as a keyboard shortcut).

  • [Basic Paragraph] style behaviour upon copy/paste

    Hi,
    we just get started changing from Quark to InDesign, and our lead layout-producer is not so crazy about style sheets, so everything she creates is using the [Basic Paragraph] Style.
    A by her created libary now contains groups of text objects in Basic Paragraph with format changes +
    When I use these groups, or copy and paste from another document, why does InDesign keep the changes like fontsize or -color, but does change the font?
    My basic paragraph does use another font, so its quite annoying INDD keep the changes, but keep change the font.
    What can I do to prevent INDD from changing the font?

    So, i made this beauuutiful thingy for a test. It looks disgusting, i know. The point is that it uses 4 fonts and different modifications.
    If I get you right, to prepare a "good" document, our layout-producer should clogg our documents with different paragraph-styles not to use the Basic? Sure, she can convert it into paths, but different collegues have to translate this stuff later so that isnt an option.
    Maybe she can "design" things like that in Illu, giving us an AI to use.
    I made an irritating discovery:
    As I built this thing with Futura as my Basicparagraph-font, i dragged it into a libary, closed every doc to change my default-paragraph-style to another font to see what happens. I set up a empty doc and dragged it back in again – no changes at all. I was surprised. Its in the basic, it has a +, and if i click on basic it changes to GillSans, if i alt+click the modifications (like the colors) turn to black… – this is what i was looking for :-)
    But why with my other test-object. Im nearly in closing time here, so i will upload an image tomorrow, but the only variable that haved changed to my second try minutes ago:
    – the objects were converted using Q2ID (Markzware)
    – the group just contained one (but another) font
    Maybe theres the problem somewhere.

  • I'm having problems with paragraph style. It remains last style even if I aplply basic paragraph style

    Paragraph style is not working properly in either two licences if got for CC InDesign 2014.2
    Styles do not apply correctly, it remains last style applied even if I aplply basic paragraph style.
    Is anybody having the same problem? Do you have any explanation or solution for it? Is there any spanish chat or forum?
    I appreciate your quick answer

    There is a Spanish forum here: Foro en español. Is there a character style applied to the text?

  • How do you duplicate a layer and then change its adjustment layer?

    This used to be easy in PS7, but it's evasive in CS4. We occasionally need to duplicate a layer and then change the adjustment layer. For instance, we might have selected a section of an image and used brightness contrast and then need to create a new layer using the same section using selective color. What we have done in the past is duplicate the layer and then change the adjustment layer. Any ideas?

    You're great!
    Thanks a million, we've been struggling with this for at least a year.
    Jim
    Jim Kosvanec, Pres.
    Giclee By The Bay, Inc.
    Stretcher Bar Warehouse (805-528-3322)
    1236 Los Osos Valley Rd. Ste. V
    Los Osos, CA 93402
    800-877-9055
    805-528-2244
    Fax: 805-528-2233
    Hours: 8:30-5 PST M-F
    Web: GicleeByTheBay.com  and StretcherBarWarehouse.com

  • (new to scripting) Only allow certain paragraph styles to break to next column/page

    Hi all,
    As stated, I'm very new to scripting. I've done a few small scripts to automate Photoshop tasks and such. I'm in the process of trying to learn Javascript as much as possible, with the hope of bringing about more efficiency for our small production department. It's a daunting task, but I'm trying my darnedest.
    One of the number one goals I have is the find a way to automate pagination of weekly transaction records. These records run between 32 to 48 pages normally, with each page having 5 columns. Creation of these pages is very systematic, so it would seem that this process should be able to be automated, but there are some challenges I'm having a hard time thinking about how to attack.
    One of the key tasks needing to be figured out is getting the records to go in with headings and subheadings always starting at the top of a page/column. Just about all the copy comes in with predetermined paragraph styles, so a script should easily be able to search for instances of each style. What needs to eb accomplished is only allowing the flow of copy to break on certain styles and not others ... (counties, towns, etc.)
    For example: if you have the following  ...
    Countyland <styled "county">
    Utopiatown <styled "town">
    46 Appletree Lane ...... $500,000  <styled "listing">
    Sold by: Some Guy   <styled "listing">
    Bought by: Other Guy  <styled "listing">
    Mortgage: This Bank  <styled "listing">
    Date: 12/14/11  <styled "listing">
    Dystopia Village <styled "town">
    47 Orangeplant Road ...... $400,000  <styled "listing">
    Sold by: Some Guy   <styled "listing">
    Bought by: Other Guy  <styled "listing">
    Mortgage: This Bank  <styled "listing">
    Date: 12/14/11  <styled "listing">
    If the two records above were to fall near the end of a column, the break to the next column should NOT occur anywhere except:
    - Before the county (causing the county to start at the top of the next column
    - Before the second town (Dystopia Village, forcing that town to the top of the next column)
    - After both (forcing whatever town/county is next to goto the top of the next column)
    So basically, I need to find a way PREVENT column breaks where they should not occur. Inserting column breaks is one thing (I know how to do that). Prevention is the issue though that confounds me.
    Does anyone have any thoughts of how to achieve such a thing? I know there are "non-breaking space" characters ... is there, or could there be, some kind of a "non-breaking return" character? Or would it be more feasible to test for the paragraph style at the bottoms of columns and insert column breaks in once it finds an appropriate match?
    Am I going about this all wrong?
    Again, any help or suggestions are more than welcome.
    Thanks much.
    ~Nate
    FYI .. using InDesign cs5.5

    I am now wondering about a possible solution. It would be one hell of a challenge for me to figure out how to code it, but I at least need to figure out the theory first, then I'll try to figure out how to code it.
    Again, the issue at hand is preventing column breaks for the "listing" style in the following example. Please note, the number of "listing" lines varies. If the following two entries (in a long list of similar entries) were to be near the end of a column, I'm trying to cause the flow of text to break only before a county style, or a town style (if it's not the first town in the county).  Basically, no breaks in the middle of listings.
    Countyland <styled "county">
    Utopiatown <styled "town">
    46 Appletree Lane ...... $500,000  <styled "listing">
    Sold by: Some Guy   <styled "listing">
    Bought by: Other Guy  <styled "listing">
    Mortgage: This Bank  <styled "listing">
    Date: 12/14/11  <styled "listing">
    Dystopia Village <styled "town">
    47 Orangeplant Road ...... $400,000  <styled "listing">
    Sold by: Some Guy   <styled "listing">
    Bought by: Other Guy  <styled "listing">
    Mortgage: This Bank  <styled "listing">
    Date: 12/14/11  <styled "listing">
    Naomi previously suggested messing with the "keep options" in the styles. This will solve the issue of preventing breaks before listing details start. But it won't help in keeping listing details from breaking, since the number of lines can vary.
    I'm now thinking ... might it be possible to have a script search all copy, looking for the last line of listings, and then apply a second listing style with a different keep option setting? The "normal listing" style would "keep next 1 line". The "last listing" style would not, therefore, allowing a break.
    Here's a map of what I'm thinking: (bear with me on the terrible syntax, this is just for illustrative purposes)
    listingNormal has keep with next 1 line applied
    listingBreak does not keep with next line
    if currentLineStyle == listingNormal
    AND
    style of next line != listingNormal {
    currentLineStyle = listingBreak
    Does this make sense? If so, does this sound feasible?
    Thanks any and all.
    ~Nate

  • Grep script that looks for paragraph style A followed by paragraph style B

    Hello,
    I am fairly new to scripting in Indesign and I have run across something I want to script that I don't know how to do. Two of the paragraph styles that are in our files are Normal and Song. I need to add an extra paragraph return between all instances of Normal followed by a Song. I tried to search the forums to see if this was already on here somewhere and if it is I didn't come across it. I would like to set it up as a grep script but if anyone has an alternative way to do this I would like to know also.
    Thanks in advance

    Hi,
    So you could use a script.
    I assume a text frame with proper story is selected and whole story is in one frame or linked frames.
    myStory = app.selection[0].parentStory;
    if (myStory.constructor.name !== "Story")
         alert ("Select a destination text frame, pls\rand try again");
         exit();
    myNormal = app.activeDocument.paragraphStyles.item("Normal");
    mySong = app.activeDocument.paragraphStyles.item("Song");
    app.findTextPreferences = null;
    app.findTextPreferences.appliedParagraphStyle = mySong;
    mFound = myStory.findText();
    len = mFound.length - 1;
    if (len >= 0)
         while (len--)
         currPara = mFound[len].paragraphs[0];
              if (myStory.paragraphs.previousItem(currPara).appliedParagraphStyle == myNormal)
              currPara.insertionPoints[0].contents = "\r";
    rgds

  • How to know if a applied paragraph style has changed

    in Applescript, is there a propertie to know if a applied paragraph style in not "the original"
    ==> title become title+
    Thanks

    One way to do it in Applescript:
    tell application "Adobe InDesign CS6"
              tell document 1
                        tell page 1
                                  tell (every text frame whose label is "frame1")
      -- paragraph 1 has no style overrides
                                            return style overridden of paragraph 1 --> false
      -- paragraph 2's leading is different
                                            return style overridden of paragraph 2 --> true
                                  end tell
                        end tell
              end tell
    end tell

  • Problem with paragraph style overrides and character formatting

    I've had this problem for a long time, and sometimes it resolves itself, sometimes it doesn't. Finally I'm begging for help.
    I am typesetting academic articles into a journal.  We use endnotes. The endnotes have both italic and regular formatting--italics for book and journal titles, and foreign phrases.
    Sometimes when I place the text, the formatting reverts to whatever it was in Word.  To try to fix that, I've begun stripping the Word formatting from the original document, making everything "Courier New" and just importing it like that.  I figured this would clear a lot of the problems I've had with fiddly formatting issues.
    I was mistaken. 
    Here is what happens:
    When I place the document it comes up in the original Courier New font, with italics and other formatting intact.  If I click "article style" which is the main article paragraph  style format, normally it changes.  but if I right click and select "apply article style" it is more likely to change the paragraph to the proper style, with italics and other formatting still intact.
    But when it gets to endnotes, I'm sort of screwed.
    My endnotes style is a bulletted style, so that I can have the endnote numbers consistent.  but this seems to screw all the style formatting.
    Here is what I do:
    With the cursor in endnote text, I click "bulleted endnote style".  The character format remains the same, with a + beside the style. The endnote number format is different, however.  If I click "clear overrides" it does in fact change to the proper formatting, but it strips any italics or other character in the text.  This is frustrating because many of these endnotes have lots of italicized journal and book titles, and it takes a long time to figure out which ones I need to reitalicize manually.
    I have tried to use the "customize style import>Style mapping" but it has not fixed anything.
    Please help me figure out how to make these transitions more smoothly.  I am open to suggestions both on how to make the changes once the document is placed in the Indesign file, and also making modifications to formats in the native Word file so that I don't have these problems. 
    Thanks
    Dan

    Sorry, that last message wasn't supposed to send (if that's not obvious!). I was writing it and got interrupted.  Damn iphone. 
    I know why there are two numbers.  This is not an issue. What I didn't finish writing was that, the note number before i bullet it is a different font/ format. Again, not a problem.  Here is something interesting, though.  If I delete that original number by placing the cursor in the middle of it (say a between the 4 and 2 of 42) then delete everything by Shift+arrow forward, press delete then delete the rest of the unnecessary characters, THEN apply the style formatting, it works just fine.  Is it something to do with the character codes of those original note numbers? 
    Word drops in so many hidden codes that it screws everything up!

  • Make paragraph style not override character style?

    Hi.
    Is there any way to make a paragraph style NOT override a character style?
    For example, I write a lot of scientific reports in Pages and then I use subscript and superscript often and so I have made a character style for that. But if I want to perhaps change the spacing between paragraphs in my body style. I select a paragraph, change the settings that I want and then I right click on the paragraph style and choose "redefine style from selection". Then I select all of that style and choose "revert to defined style" to get the updated paragraph spacing. But what this does is that it overrides all of the character styles so that everything in sub/superscript, bold, italic etc get back to the style. This is really bugging me out.
    For the character styles you can select what attributes you want them to affect, is there any way to do this with paragraph styles as well? Or maybe some of you have got a good way to make it work.
    Thanks in advance.

    When you redefine the paragraph style, all paragraphs using that style will display the new style properties, unless you've overriden them. Presumably this is why you choose "revert to defined style", so that other paragraphs that you've stylistically modified take on the proper paragraph style properties. If not, why revert at all?
    Instead of using revert, why not re-apply the paragraph style (just click on the selected style in the drawer, or pick the selected item from the pop-up menu). It will discard your unwanted paragraph style overrides, and preserve the character styles.

  • How to change the point size in a plot.

    I want to set the point size in an XY plot to be proportional to the amplitude. So, when the amplitude is small, the point on the plot should be small and when the amplitude is large, the point on the plot should be large

    > I want to set the point size in an XY plot to be proportional to the
    > amplitude. So, when the amplitude is small, the point on the plot
    > should be small and when the amplitude is large, the point on the plot
    > should be large
    The other post points out that the point size applies to all points in a
    plot, and it has only a few possible sizes.
    The better solution is probably to look at the picture example for XY
    graphs. You can then open up the diagram and look at the source code
    for it. You will find a loop that draws for each point. You might also
    want to look at the scatter plot example.
    Greg McKaskle

  • Is this possible? Using Illustrator Script to duplicate EPS file 35 times & changing C,M,Y,K value?

    Hi everyone,
    I need HELP I have a bunch of vector clip arts, which are Black (C,M,Y,K100). I need it in 35 different colors Saved as Illustrator 8 EPS and I also need those file in 72 DPI PNG Transparent files.
    Thanks for any help.
    Akkudo.

    Good evening,
    0) In your templates give a specific namme to each path or groups or items via the layers window.
         The objective is to use a script like these two:
        Set myLayerCercle = my_Laieur_elements.GroupItems("Laplupart").PathItems("LaplupartCercle")
            myAiApp.Redraw
            myLayerCercle.FillColor.Spot.Color.Cyan = 0
            myLayerCercle.FillColor.Spot.Color.Magenta = 100
            myLayerCercle.FillColor.Spot.Color.Yellow = 80
             myLayerCercle.FillColor.Spot.Color.Black = 0
           myAiApp.Redraw
    or
      textRef.Paragraphs.Add ("myNewText")
        textRef.Paragraphs(1).ParagraphAttributes.Justification = aiRight
        textRef.Paragraphs(1).CharacterAttributes.Size = 12
        textRef.Paragraphs(1).CharacterAttributes.HorizontalScale = 10
        textRef.TextRange.CharacterAttributes.BaselineShift = fontBaseLineShift
        textRef.TextRange.CharacterAttributes.TextFont = myAiApp.TextFonts.Item("Times")
        textRef.TextRange.CharacterAttributes.FillColor.Black = 0
        textRef.TextRange.CharacterAttributes.FillColor.Magenta = 100
        textRef.TextRange.CharacterAttributes.FillColor.Yellow = 0
        textRef.TextRange.CharacterAttributes.FillColor.Cyan = 0
    If you agree please send your eps file via my email. I could be than more efficient.
    Have a good evening
    Patrice
    *) open an office sofware (Word or Excel) and go to the Visual basic editor (alt+F11) and
    copy and paste these script; replace nom_docAi  with your eps file name
    Public nom_docAi
    Sub myPrg()
    call OpenAi
    call openBaseFile                          '= open the eps file
    call myRectangle(100,100,200,300)
    call saveEPS(nom_docAi )
    call savePNG(nom_docAi )
    end sub
    Sub OpenAi()
    '*** le fichier excel et illustrator se trouvent dans le même répertoire
    myPath = ActiveWorkbook.Path
    '*** Définition de la variable "application"
    Set myAiApp = CreateObject("Illustrator.Application.CS4")
    End Sub
    Sub openBaseFile()
    '*** Définition et ouverture du fichier illustrator de base
    nom_eps = "cycle.eps"
    'nom_docAi = myPath & "\" & nom_eps
    nom_docAi = "G:\graph" & "\" & nom_eps
    Set myDocAi = myAiApp.Open(nom_docAi, 1)
    End Sub
    Sub saveEps(myPictureName)
    '*** Sauvegarde fichier
    Set myDocAi = myAiApp.ActiveDocument
    Set myEpsSave = CreateObject("Illustrator.EPSSaveOptions.CS4")
        myDocAi.CropBox = myDocAi.VisibleBounds
        myEpsSave.EmbedAllFonts = True
        myEpsSave.Preview = aiColorTIFF
        myEpsSave.postscript = ailevel3
        myAiApp.ActiveDocument.SaveAs myPictureName, myEpsSave
    End Sub
    sub myRectangle(x, y, LenghRect, HeightRect)
    '*** Sélection du calque recevant les rectangles
    Set Laieur = docAi.layers("data")
    myAiApp.Redraw
    Set myRect = docAi.PathItems.Rectangle(y, x, LenghRect, HeightRect)
    myRect.FillColor.Cyan = 0
    myRect.FillColor.Yellow = 100
    myRect.FillColor.Magenta = 35
    myRect.FillColor.Black = 0
    myRect.Stroked = False
    myAiApp.Redraw
    'mTab = myCColor(mType)
    End Function
    Sub savePNG(myPictureName)
    '*** Sauvegarde fichier
    myPictureName = Replace(myPictureName, ".eps", ".png")
    Set myAiApp = CreateObject("Illustrator.Application.CS4")
    Set docAi = myAiApp.ActiveDocument
    Set pngExportOptions = CreateObject("Illustrator.ExportOptionsPNG24.CS4")
    pngExportOptions.AntiAliasing = True
    pngExportOptions.Transparency = True
    docAi.Export myPictureName, aiPNG24, pngExportOptions
    End Sub

  • Changing bullet point size in Keynote '09

    HELP! I have a major presentation in a couple hours and I am about to toss KEYNOTE out the window.
    I am typing slides and when I indent a bullet point to show a subtopic I can not figure out how to get the next line to start the next point....it just keeps adding points in the indented area.....
    Powerpoint has a simple icon to increase or decrease the List Level
    Where is this in Keynote  -
    Please help!

    Inspector>Text Tab>Bullets
    You can also use Tab to increase the level and shift tab to decrease it.

Maybe you are looking for

  • How disable the full screen option in the standard or wireframe video player ?

    I was wondering if (and how) it's possible to just disable the full screen option in the controls that appear below the video player (standard or wireframe). I want to have a video player with the progression bar, play / pause options, the counter wi

  • REPORT PAINTER TRANSACTION

    Hello, How to assign a tcode to a report painter? 10nks!! gabriel

  • OS X Yosemite Recovery Update 1.0 - Reappears in App Store Updates?

    Hi there, I've just updated OS X Yosemite to 10.10.3 and have noticed that OS X Yosemite Recovery Update 1.0 does not seem to complete its installation for some reason.  I now have versions installed on April 12, April 13, and April 18, and still hav

  • Dynamic Actions with multiple infotypes.

    Hi, I have the following business requirements where I am supposed to trigger a function call when the users creates an action via PA40 and the Action Type = 'X1' and subsequently saves IT0001 and IT0019. Both IT0001 and IT0019 are configured as part

  • Product key won't work

    Hi support, I have a acrobat X pro product key. When I try to reinstall acrobat x pro and activate acrobat x pro, it said my product key not for this product. I want to check is it my product key have any problem?