Paragraph styles reassured .js to .jsx

Hi folks, could use a littele help:
Who knows how to translate the following old script to work with InDesign CS 6 and CC?:
1 myStyles = app.documents[0].paragraphStyles;
2 app.findPreferences = null;
3 app.changePreferences = null;
4 for (var n = 1; myStyles.length > n; n++){
5 app.documents[0].search("", false, false, undefined, {appliedParagraphStyle:myStyles[n]}, {appliedParagraphStyle:myStyles[n]});}

Hi,
Line 5 is old document.search() method (stopped in CS3 if I remember good)
In newer versions:
myStyles = app.documents[0].allParagraphStyles;
app.findTextPreferences = app.changeTextPreferences = null;
for (var n = 1; n < myStyles.length; n++){
    app.findTextPreferences.appliedParagraphStyle = app.changeTextPreferences.appliedParagraphStyle = myStyles[n];
    app.documents[0].changeText();
app.findTextPreferences = app.changeTextPreferences = null;
One can start a loop from 0 to include [Basic Paragraph Style]
Jarek

Similar Messages

  • I want to open "Paragraph Style Options" dialogue using Script(jsx)

    Hi,
    I have created a paragraph style using JSX.
    var myDocument = app.activeDocument;
    var myParagraphStyle = myDocument.paragraphStyles.item("myParagraphStyle");
    Now I want to edit my paragraph style using the "Paragraph Style Options" window. How can I open the window for myParagraphStyle using JSX?
    Is there any way to do it? I don't want to manually double click the name in the list to open it.

    @kapoor_aman27 – with a little trick we could select a distinct paragraph style in the Paragraphs Style panel.
    Add a new text frame to the document, add some contents, one character is sufficient. Format its contents with your paragraph style. Set the Paragraph Styles panel to visible. Select the text in the text frame with something like that: app.select(myTextFrame.texts[0]). Remove the text frame; the paragraph style stays selected in the panel.
    The next step would be to invoke the "Paragraph Style Options" panel. The id for the appropriate scriptMenuAction is 8481.
    try{
    app.scriptMenuActions.itemByID(8481).invoke();
    }catch(e){$.writeln(e.message)};
    But unfortunately this would throw an error. Something like this:
    (Error message in German:)
    "Mit der angeforderten Aktion wurde ein asynchrones, modales Dialogfeld geöffnet,
    für das eine Vorschau erstellt werden kann.
    Dies ist nicht mit der Skriptarchitektur kompatibel, daher wurde das Dialogfeld
    mit der Standardschaltfläche automatisch verworfen."
    (Roughly translated to English:)
    "An asynchronous, modal dialog box was opened by this action.
    A preview can be created with that dialog box.
    This is not compatible with the scripting architecture, therefore the dialog box
    with the standard button was automatically rejected."
    So I see no chance to do what you want.
    (Tested with inDesign CS5.5 on Mac OSX 10.6.8)
    Don't know, if that behavior has changed for more recent versions of inDesign…
    Uwe

  • JS Accessing the Paragraph Styles Panel Menu?? PLEASE HELP!

    I haven't heard anything yet about this topic, can anyone help me?
    Hi all,
    I'm hoping you can help me with is, I'm about to tear my hair out! I'm using JavaScript in InDesign CS3 (PC). I have three heading scripts that I wrote that go through a series of actions when clicked, and I need to be be attached to the appropriate paragraph styles. This is so the user will receive a certain look and feel when they click the style, but they won't know a script ran at all, they'll think it's just another paragraph style.
    I ran the menu id script from the InDesign Scripting Guide, and it says that the root ID should be "Paragraph Style Panel Menu", however, that is not working. HELP! How can I get InDesign to reference the existing Paragraph Style Panel Menu?
    THANK YOU! Code below:
    myDoc = app.activeDocument;
    var setpath = "~/Application Data/Adobe/InDesign/Version 5.0/Scripts/Scripts Panel/";
    var myScript1 = new File(setpath + "Heading 1.jsx");
    var myScriptAction1 = app.scriptMenuActions.add("InD - Heading 1");
    var myEventListener1 = myScriptAction1.eventListeners.add("onInvoke", myScript1, false);
    var myScript2 = new File(setpath + "Heading 2.jsx");
    var myScriptAction2 = app.scriptMenuActions.add("InD - Heading 2");
    var myEventListener2 = myScriptAction2.eventListeners.add("onInvoke", myScript2, false);
    var myScript3 = new File(setpath + "Heading 3.jsx");
    var myScriptAction3 = app.scriptMenuActions.add("InD - Heading 3");
    var myEventListener3 = myScriptAction3.eventListeners.add("onInvoke", myScript3, false);
    try{
    var myScriptMenu = app.menus.item("$ID/Paragraph Style Panel Menu");
    myScriptMenu.title;
    catch (myError){
    var myScriptMenu = app.menus.add("$ID/Paragraph Style Panel Menu");
    var myScriptMenuItem1 = myScriptMenu.menuItems.add(myScriptAction1);
    var myScriptMenuItem2 = myScriptMenu.menuItems.add(myScriptAction2);
    var myScriptMenuItem3 = myScriptMenu.menuItems.add(myScriptAction3);

    K Jane wrote:
    "How can I get InDesign to reference the existing Paragraph Style Panel Menu?"
    var myParagraphStyle = myDoc.paragraphStyles.item("myParaStyelName");
    Is this what you are after? Don't know how it relates to your sample code though.
    Brett

  • Programming paragraph styles using the Javascript

    I am exporting xml into a  indesign template and then creating a .jpeg programmaticatlly.  On conversion, is there anyway to format the xml so that paragraph styles are applied?

    Let me be clear:
    1.  We have some xml i.e.
    <?xml version="1.0"?><Root Customer="BusinessCard" xmlns="" ID="0"><Story><Story><Field ID="1" Label="Fullname" Type="TextBox" Required="True" Prefix="" Suffix="" RegEx="">JohnDoe</Field><Field ID="2" Label="Job Title" Type="TextBox" Required="False" Prefix="" Suffix="" RegEx=""></Field><Field ID="3" Label="Telephone" Type="TextBox" Required="False" Prefix="T   " Suffix="&#xd;" RegEx="">T   0123456456&#xd;</Field><Field ID="5" Label="Mobile" Type="TextBox" Required="False" Prefix="M  " Suffix="&#xd;" RegEx="">M  0123456789&#xd;</Field><Field ID="6" Label="Email" Type="TextBox" Required="True" Prefix="" Suffix="" RegEx="">[email protected]</Field></Story><Field ID="7" Label="Address1" Type="TextBox" Required="False" Prefix="" Suffix="&#xd;" RegEx="">&#xd;</Field><Field ID="8" Label="Address2" Type="TextBox" Required="False" Prefix="" Suffix="&#xd;" RegEx="">&#xd;</Field><Field ID="9" Label="Address3" Type="TextBox" Required="False" Prefix="" Suffix="&#xd;" RegEx="">Middlesex T5 4566&#xd;</Field><Field ID="11" Label="Postcode" Type="TextBox" Required="False" Prefix="" Suffix="" RegEx="">Visit uytyu</Field></Story></Root>
    2  We have an indesign template. template.indd
    3. We import the xml into the template programatically and need to apply character styles to the prefixes on mobile, and telephone numbers.
    4.  We need to apply the character styles in the .jsx script  that then exports the image as a jpeg and a pdf.

  • How do I use multiple paragraph styles in one line?

    I'm working on my thesis in APA style.  I'm creating a Table of Contents with the help of Pages.  When you get to Level 3 in APA headings (no problems with Levels 1 and 2) it needs to look like this:
    [0.5in Indent] Masculinities in higher education.  For men, the college experience.... (paragraph starts on same line as the heading).
    I created a paragraph style for the (bolded) heading above [Heading 3].  When I do this, like magic the heading shows up in the table of contents (yeah!).  However when I do this the rest of the paragraph shows up too (boo!).  When I highlight to change the just rest of the paragraph (not the heading) to the style "Body" it changes the heading too and removes it from the table of contents.  How can I make 2 paragraph styles work together in the same paragraph so I can use the tale of contents tool??  Surly there is a work-around.
    Pages 5

    As the name implies, paragraph styles are not intended to be used on a unit smaller than a paragraph. Therefore if you want the TOC to be automatically generated then you need to have distinct  paragraphs... as you specify the APA style with the content and heading continuous then you will have to manually create the TOC.

  • In Pages (5.5.1) can I create multiple Paragraph Styles within one paragraph?

    In Pages (5.5.1) can I create multiple Paragraph Styles within one paragraph. 
    I need to make a table of contents for my Mater's Thesis and want to use the automatic table of contents feature.  I want the first sentence of a paragraph to have a different paragraph setting than the rest of the paragraph.  Is this possible?
    Thanks!

    Nice of you to be doing this for your Mother's Thesis.
    There are several issues here:
    1. A Paragraph Style is what it says, the style for the paragraph
    2. You can format text within a paragraph by applying a Character Style
    3. Pages 5.5.1 lets you apply formatting to overall text for the T.O.C. but not parts of it and you can not retain that formatting as a Paragraph style
    So in answer to your question, no.
    You will need to create the T.O.C. manually and unfortunately as Pages 5.5.1 can't create bookmarks (just one of over 100 missing features) you will be unable to link the T.O.C. to the referred pages in the list.
    Peter
    Apple's marketing slogan:
    Pages 5.5.1 - Can't Do That!

  • Paragraph styles all default to wrong character style

    So I set up a template and based all my character styles on my basic body copy. However, every new text box I create it defaults to the "character styles" to my section header color and sizing. I have to right click and "clear character styles" every single time. I've never had this happen before and cannot figure out how to fix it, it is such a PAIN!

    From your explanation, I suspect your use of Character Styles might need to be redirected to Paragraph Styles. But that is conjecture, so I apologize if I'm wrong. In any case, to solve your problem; with nothing selected, choose No Character Style in the Character Styles panel. That sets the default for new frames.

  • Cross Reference, Paragraph Style conflict?

    I'm created an epub file and have a cross reference for one of my chapter titles. When I export it to ADE the final product has the cross reference in the file but the paragraph style for the text that I linked lost all of it's styling somehow. The paragraph style is supposed to be centered and have space after it but it is completely gone but the code is still in the xhtml file.
    I have opened the xhtml file and cannot see where the issue is. Has anyone else had this problem exporting from CS4? If so, how do you fix it?
    Thank you so much!

    According to the FM7 Help, the variables for background text frame use might be:
    <$paranumonly[paratag]>
    to pick up the first instance on a page, and
    <$paranumonly[+,paratag]>
    to pick up the last.
    The "+," bit is the key. I've never tried it myself.
    This presumably also assumes that the paras of interest all have the same format name.

  • How can i give multiple paragraph styles on the same line

    i want to give different paragraph style in the same line in an indesign document. bt when i tried it, it is coming in two different line.
    actually i am doing a project in which Frame maker document is transformed into indesign document. in frame maker this is possiable, but in indesign i cannot give different paragraph style in the same line of the document.
    Is there any way to do this ????

    YaneshTyagi wrote:
    i want to give different paragraph style in the same line in an indesign document. bt when i tried it, it is coming in two different line.
    actually i am doing a project in which Frame maker document is transformed into indesign document. in frame maker this is possiable, but in indesign i cannot give different paragraph style in the same line of the document.
    Is there any way to do this ????
    Hi, Yanesh:
    Please understand, the FrameMaker feature known as a run-in paragraph, which is a paragraph with a "carriage return" but without a "line feed," HAS NO COUNTERPART in InDesign. InDesign also lacks the FrameMaker side heading feature, which is created by the combination of a reserved area in the text frame and the paragraph property to inhabit that area. FrameMaker separates paragraphs by using the larger of space below paragraph and space above paragraph, but InDesign separates paragraphs by adding the space below paragraph and the space above paragraph.
    There are several complicated manual methods of simulating these FrameMaker properties in InDesign.
    Here's a recent forum discussion of these exact issues: http://forums.adobe.com/message/3759635#3759635. The thread mentions DTP Tools' conversion tool, the MIF Filter commercial plug-in for InDesign, and discusses its shortcomings. I don't recall it mentioning in-tools.com plug-ins that can simulate side headings, like those in FrameMaker, but they don't convert FrameMaker to InDesign. 
    You can add your vote for InDesign's developers to include these FrameMaker features, and any others you'd like to see, here: wish.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • How do I stop ID from assigning a paragraph style to the TABLES?

    In-Design is adding "H1" paragraph style to EVERY table is inserted, so the table headers formatting is affected by that H1 style.
    I guess it chooses H1 because it's the FIRST style I created (and then modified the "basic paragraph" to modify the rest of default text).
    It's like it's adding "Style_ID=1"
    I tried placing the character in different places, to make sure it's not the style the cursor is in which is inherited, and no, no matter where I place the cursor, when I "insert table" the cursor is automatically placed into the first cell (header cell) and the paragraph "H1" is selected (and applied)
    Adding a table with NO headers does the same, so it's not me that confused style names and applied some to the wrong place.
    H1 is not used and table and cells styles are not based in it.
    I don't know whether it's a bug, but IT FEELS like a bug.
    How do I expect it to work?
    I expect that by creating a table, NO style be applied other than the table's. (Not even the basic one)

    You might have set the default paragraph style for the document (which you set by selecting a paragraph style with no text frame selected) to your H1 paragraph style.
    Make sure it's on "Basic paragraph" when you select the type tool..

  • How do I edit a paragraph style in Muse?

    Is there a way to change a typeface or other detail in a paragraph stylesheet in Muse? I've tried duplicating the style, and then, when I delete the old one, I replace it with the new one. Is there a more direct way to do that?

    Hello,
    If you create a paragraph style, then change any attribute, the style has an override. If you'd like to keep this override and redefine the style click the "redefine selected style from attributes" button (highlighted in the screen shot.)
    More info is here:
    http://helpx.adobe.com/muse/using/creating-using-character-paragraph-styles.html

  • How do I access *load paragraph styles* from the styles pallet menu?

    Adobe help informs me that I can bring styles from other documents into an existing document by doing this:
    "To copy paragraph styles from one publication to another choose Load Paragraph Styles from the Paragraph Styles panel menu."
    I do not see any menu in the paragraph style menu. I am in CS5. What am I missing?

    I'm sorry, I found it. I had to go back to my G4 and the CS version to see what to do. I did not recognize the small feature on the window yielding the menu.

  • How do I show table paragraph styles in keynote 6.1 (mac)?

    Hi community,
    I am tryying to apply changes to paragraph styles in keynote 6.1 (mac). But in the list which opens when i click in the triangle only the basis paragraph styles are seen.
    Any ideas how and whre i can find theses styles.
    Thanks
    slyrs

    I am sorry that I cannot make myself clear - perhaps because of my language competence
    1) There is a table style (for the whole table)
    And there are PARAGRAPH-styles for the text-attributes of the text in the table-cells (bold, italic, size, font etc.). I would call this a paragraph-style. This can be seen here:
    But this style cannot be edited or changed because it does not show up in the dropdown of the parapgrah-styles - as can be seen here:
    You DO NOT FIND the paragraph-style ("Absatzstil" in German) "Tabellenstil 1" in the dropdown.

  • Multiple paragraph styles in one line

    I'm creating a training manual and I am having trouble with paragraph styles. Here's an example of what I am trying to do:
    "The Dog walks up the hill"
    In the above example, I have created a style for the bolded text and connected it my table of contents. The idea is when I create and update the TOC, "The Dog" will be the entry with the remaining text omitted from the TOC. The issue I am having is because the text is on one line, I cannot have multiple styles. I've tried writing just "The Dog" and then either changing the style or deleting the paragraph break to connect the text below to the main line. Once I erase the paragraph break and the text is on one line, only ONE style is maintained. Now, I can modify the character style; however, because the paragraph style is still the one connected to the TOC, the entire paragraph appears in the TOC.
    Any advice would be greatly appreciated! I've searched everywhere to no avail.
    Thank you very much for your support.

    ajmiddle18 wrote:
    I'm creating a training manual and I am having trouble with paragraph styles. Here's an example of what I am trying to do:
    "The Dog walks up the hill"
    In the above example, I have created a style for the bolded text and connected it my table of contents. The idea is when I create and update the TOC, "The Dog" will be the entry with the remaining text omitted from the TOC. The issue I am having is because the text is on one line, I cannot have multiple styles. I've tried writing just "The Dog" and then either changing the style or deleting the paragraph break to connect the text below to the main line. Once I erase the paragraph break and the text is on one line, only ONE style is maintained. Now, I can modify the character style; however, because the paragraph style is still the one connected to the TOC, the entire paragraph appears in the TOC.
    Any advice would be greatly appreciated! I've searched everywhere to no avail.
    Thank you very much for your support.
    It depends on the breed of dog.
    Is the paragraph always a single line?
    Is this dog the leader of the pack? IE, does the phrase you want to keep always begin the paragraph? If so, then you can separate the dog from the pack in the TOC. One way is to surround the pack with a unique character or marker in the main text, like End Nested Style Here, - one after dog, and another after hill, and create a paragraph style for the doggie paragraph to use in the TOC. This paragraph should contain a nested character style that applies microscopic text properties, like paper character color, font .1pt, and horizontal scale .1%. The TOC entries should use nested paragraph styles; the source paragraphs need you to insert the End Nested Style Here markers. The nested style definition in the TOC paragraph styles should apply no character style through the first end nested style marker, then apply microscopic through the next end nested style marker. This will shrink the walks...hill text to an invisible speck, so small that it shouldn't interfere with tab leaders and page-references.
    Another approach is to use a single-row table for the heading, with the dog pent nicely in the left cell, and the pack in the right cell. Each cell contains a paragraph, so only extract the dog to the TOC.
    Search Google for terms like "InDesign hide part of paragraph in toc knowhowpro," "InDesign suppress part of paragraph in contents knowhowpro," "InDesign two paragraph styles on one line," and similar phrases without quotes for some good discussions and a variety of approaches that include layers, anchored frames, and conditional text.
    Search Google for terms like "InDesign conditional text," and "InDesign nested paragraph styles," without quotes for details.
    http://forums.adobe.com/message/3206266 has a long discussion that may shed some additional light.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • How can I force a paragraph style without losing italic?

    This has been annoying me for ages. I work on documents in Word, applying italic to book titles etc, and then import into indesign. I apply a paragraph style and three times out of four the bits of italic are preserved. However, the fourth time the paragraph style doesn't take (probably because of the presence of italic) and I have to force it to do so by using Alt-click. Invariably the italic is then replaced by roman.
    It's happening just now with a whole lot of footnotes and endnotes in a book I'm working on and means I have to go back through them all, manually applying italic to my book titles and references. Is there any way to force an endnote/footnote paragraph style without losing the italic text?
    Thanks for any suggestions,
    Tom.

    I'm not sure that forward planning is so necessary here.
    If your only concern is losing italics when importing from Word, create,
    in InDesign, an italic character style. Then do a search and replace
    throughout the InDesign document (after you've placed the Word file)
    searching for italics formatting, and replacing with your italics
    character style.
    That will prevent you from losing your italics formatting.
    Repeat for bold, bold italics, superscript, subscript, and anything else
    the author uses.
    There are some scripts that help in this process (I think one of them is
    called "preptext", by Jongware).
    If you want a comprehensive solution that can find every type of
    formatting override and creates and applies the appropriate character
    style, check out my "Create Character Styles from Overrides" script,
    available under the scripting tab on freelancebookdesign.com.
    Ariel

Maybe you are looking for

  • IPod 80 GB Classic will no longer connect to computer

    All these problems started yesterday afternoon. Earlier that morning, I had synched my iPod with a few new songs without any problems. Then, I wanted to add more that night and all of a sudden, the problems began. My iPod will no longer stay connecte

  • The Finder can't complete the operation because some data in "FILE NAME" can't be read or writen. (Error code -36)

    I have a RAID that my Mac says is damaged. It does mount, so I want to copy as much of the data as I can. I tried SuperDuper!, but it crashed (or gave me error and stopped).  I tried copying and pasting entire drive (1.75TB) but it stopped with this

  • View Not Rendering Correctly

    I'm using the SAP UI5 Router functionality to navigate between view. I've noticed that if I navigate from a view that doesn't require much scrolling to one that does and then navigate back to the previous view via a button on a page that when I go ba

  • WIFI prob? (latest update 6.0.2) iphone5

    After the most recent iOS update (6.0.2), my iphone seems to not find wifi connections appropriately..which causes my battery to drain a lot faster. If my phone DOES find a wifi connection, upon connecting, there will be no wifi connection icon at th

  • Powermac G5 shuts down frequently

    I have a dual 2.3GHz G5 that has been been shutting down during normal use. I have come to think it may be related to audio hardware, as it frequently occurs when I try to start iTunes, Audacity(audio editor) and it seems to happen randomly while vie