[JS IDCS5] Create tags from paragraph styles

Hello,
I would like to iterating through al the paragraph styles within a document to create there tags from. The tags should have the same name as the paragraph styles. Is that possible and how?
Regards, Sjoerd

Hi Phil,
Absolute beginer here. The script creates tags for the styles outside groups, but for some reason it doesn't create the tags out of the Paragraph Styles in folders.
I enabled the line below and tried to change the "myPStyle"  for "myAllPStyle" in the following lines, but still nothing. Gives error when reaches the line myDoc.changeText();
Any hint?
var myAllPStyle = myDoc.allParagraphStyles; //if you want this enable a line all the folder paragraph styles also consider
for (i=2; i<myAllPStyle.length; i++){
     var myAllPStyleName = myAllPStyle[i];
     //alert(myPStyleName.name);
     try{
          var myXml = myDoc.xmlTags.add(String(myAllPStyleName.name));
          }catch(e){}
     app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
     app.findTextPreferences.appliedParagraphStyle = myAllPStyleName;
     app.changeTextPreferences.markupTag=myAllPStyle[i].name;
     myDoc.changeText();
     app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
Also, how can I make it Map the tags with the PStyles by name after with the script?
Thanks so much
Hector

Similar Messages

  • CS4 creating hyperlinks in TOC from paragraph style sheet

    Hi all
    Does anyone know if it's possible for a script to find all instances of text in a named paragraph style  and then link each instance to the corresponding entry in a modified TOC?
    The workflow is for a 800-item catalogue created in CS4. At the moment, the title for each entry is set in a dedicated paragraph style; once all entries are signed off, I generate a TOC listing all the items. All very straightforward.
    My client now wants an interactive PDF so that clicking on any item in the TOC will take him automatically to the relevant page in the catalogue. I want to avoid having to generate those hyperlinks manually… I know very little about scripting but I do know this is exactly the sort of thing that should be possible:
    – find first instance of text in Para Style 1
    – create hyperlink named with that text
    – link this to corresponding text in Para Style 2
    – repeat for all instances of text in Para Style 1.
    But I also know that the hyperlink/cross-reference function can be a little counter-intuitive and I don't know whether I'm asking for the moon on a stick.
    Thanks!

    There's an excellent script* called LiveTOC which does exactly what you're asking for. It allows you to turn all your TOC entries into hyperlinks for PDF export.
    Check it out: http://www.freelancebookdesign.com/scripts/live-toc
    Ariel
    * which happens to have been written by me

  • Mapping XML tags to paragraph styles that contain nested styles

    I am importing XML into InDesign (CS5.5) and the tag mapping to styles is working fine until I get to a paragraph style that contains a nested style.
    I have a sentence that starts with a number:
    1the dog runs fast.
    In InDesing properly styled looks like this:
         1  The dog runs fast.
    (tab)1(tab)The dog runs fast.
    The number is styled with a character style (Number) and the whole sentence is styled with a paragraph style (Sentence). In order to get the tabs in between the number, I have a nested style within the paragraph style (Sentence). This triggers the tabs when it hits the character style (Number) like this:
    Number up to 2 Tab Characters
    In XML, it looks like this
    <sentencetag><numbertag>1</numbertag>The dog runs fast.</sentencetag>
    Sentencetag is mapped to Sentence paragrph style and Numbertag is mapped to Number character style, but the nested style for the tabs are not displaying. I just get this in IND.
    1the dog runs fast.
    Everything works beautifully until I hit the nested styles, which I do need to get to work somehow. Any help would be much appreciated.
    Thanks in advance!

    It sounds like your tab characters are actually disappearing from content in the XML. Jeff was responding to the fact that they need to be there, and you state that you originally had them in your document, but they are not showing up once imported through the XML.
    The tabs may be disappearing in the XML document due to the "TAB" character in your text editor not being a tab, or at least not properly-formed XML TAB equivalent, OR because you are not "importing whitespace elements" when you import your XML.
    Importing whitespace elements can wreak havoc on other things in your XML structure and styled layout within the Indesign document, so I would put the XML quivalent of TAB everywhere a tab should be in your XML, and make sure NOT to import whitespace (when importing XML using "Merge Content", select not to import whitespace items from the import options).
    I believe the XML friendly character code for a TAB character is "&#9;" or "&#09;" but have not tested this. Don't include quotes when adding the character code, just the ampersand, semicolon, and everything in-between.
    Also, sounds like your tags are mapping ok for you, so your XML should look something like:
    <sentencetag>&#9;<numbertag>1</numbertag>&#9;The dog runs fast</sentencetag>.
    It should't matter where you put the TAB character equivalent in relation to your nested tag.

  • Creating a new paragraph style based on text in a document

    I'm working on some scripts for a new ad our company is working on. They are wanting to have the ability to change the font weekly in the ads. However, they want the style sheets to change based on this. What I am having to do is write a script that gets the properties of the different paragraphs in the selected text frame, and make paragraph styles. Is there a way to get the properties of paragraph 1, and use that information to make a new paragraph style? Here is what I have so far;
    set charaStyle to get properties of character charaSelect of paragraph paraOne of myBox
    set makeStyle to make character style with properties {name:"MF Price" & charaSelect, based on:properties of character charaSelect}
    We are using InDesign CS 3. Thank you in advance for the help.

    this way - build ParaStyle definition from selected text - works only in UI
    in scripting you need to write your own procedure - read all params and set them one-by-one in ParaStyle definition
    robin
    www.adobescripts.com

  • Create numbered list paragraph style

    Hi;
    I have Pages version 5.2 installed on my MacPro 10.9.4.
    I am trying to create a numbered list paragraph style w/o success; since the numbered list attribute isn't being remembered as part of the paragraph style.
    Next time i mark something as belong to the paragraph style i created, it shows w/o a number (numbered list isn't set).
    What am i doing wrong?

    Using Pages 5.2.
    Just one of the over 110 missing features:
    http://www.freeforum101.com/iworktipsntrick/viewtopic.php?t=424&sid=571e57a6fbee e115ddb08955041013cc&mforum=iworktipsntrick
    Use Pages '09 if you have it.
    Peter

  • Create Bookmarks from Word Styles on Mac

    With the noticeable absence of PDFMaker for word on the mac creating bookmarked pdfs from word styles seems to be either impossible or less than straightforward on the Mac platform. Does have a solution for how to do this?

    It amazes me that the product is sold for Mac but has reduced functionality. The price is the same as for PC and the customer is not informed about this reduced functionality.  This is concerning from a business integrity point of view.  Had I known about this reduced functionality, I would not have purchased the software. This does not provide me with any more functionality that the Send to PDF function that comes with Microsoft automatically.
    I recommend that Adobe  a) Inform purchasers of the product for MAC of this decreased functionality in the process of purchasing, like a warning that the customer must acknowledge and b) reduce the price of the product for MAC as a result of the decreased functionality and c) initiate engineering to correct the problem immediately.  Mac's are not going away, they are increasing in popularity, and as such, the software must adapt.  Alternatively Adobe should refund the cost of the software.
    Concerned customer,
    PMcG

  • Find start text index from paragraph style?

    hi,
        In my project,i have paragraph style name,i need to find out that paragraph start and end index positon ?
    pls,anyone help me?
    thanks,
    screen410099

    Hi Saud,
    Try the below script.
    var activeDoc = app.activeDocument;
        app.findGrepPreferences = NothingEnum.nothing;
        app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences.appliedParagraphStyle = "XXXX";//Give your paragraph Style name here
    var foundRefList = activeDoc.findGrep();
        app.findGrepPreferences = NothingEnum.nothing;
        app.changeGrepPreferences = NothingEnum.nothing;
    var myCount =0;
    var foundListLength = foundRefList.length;
    for (var j = 0; j<foundListLength; j++){
        var myParas = foundRefList[j].paragraphs;
        var myParaLength = myParas.length;
        for (var i = 0; i<myParaLength; i++){
            var myText  = myParas[i].texts[0];
            app.select(myText);
            var myId = j+"_"+(i+1);
            var myHyperlinkCitDestination = activeDoc.hyperlinkTextDestinations.add(myText, {name: myId});
            myCount++;
        app.select(NothingEnum.nothing);
        alert("Process Completed\n"+myCount+" destinations added");
    p.s: I've not tested it, please check this at your end and let me know.
    ~Green4ever

  • From paragraph Style to "New Hyperlink Destination"

    Dear InDesign Experts
    Please help me to find a way or Script to add all headings of specific paragraph style to "New Hyperlink Destination....(Text Anchor)"
    and ... is there any automation for such a task?
    Thank you in advance

    Hi Saud,
    Try the below script.
    var activeDoc = app.activeDocument;
        app.findGrepPreferences = NothingEnum.nothing;
        app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences.appliedParagraphStyle = "XXXX";//Give your paragraph Style name here
    var foundRefList = activeDoc.findGrep();
        app.findGrepPreferences = NothingEnum.nothing;
        app.changeGrepPreferences = NothingEnum.nothing;
    var myCount =0;
    var foundListLength = foundRefList.length;
    for (var j = 0; j<foundListLength; j++){
        var myParas = foundRefList[j].paragraphs;
        var myParaLength = myParas.length;
        for (var i = 0; i<myParaLength; i++){
            var myText  = myParas[i].texts[0];
            app.select(myText);
            var myId = j+"_"+(i+1);
            var myHyperlinkCitDestination = activeDoc.hyperlinkTextDestinations.add(myText, {name: myId});
            myCount++;
        app.select(NothingEnum.nothing);
        alert("Process Completed\n"+myCount+" destinations added");
    p.s: I've not tested it, please check this at your end and let me know.
    ~Green4ever

  • Exporting to filename from paragraph style

    I have a 80 page indesign file.  I would like to export to single page pdfs, with filenames based off a paragraph style on each page.
    Is this possible?  I have no background or experience with scripting.  Any help would be much appreciated.
    Thanks
    Derek

    The link you sent me was about Applescript. But I looked it up in the Javascript reference and this seems to work.
    You need to make three changes:
    Line 6: Change test to the name of your paragraph style.
    Line 15: Change [Smallest File Size] to the export preference you like to use, so you get resolution, bleed etc correct.
    Line 19: Change export path, I exported mine to my root, my harddrive, if you are on a pc "/c/cookbook/" + pdf_name + ".pdf" might be a better path.
    for(var p = 0; p < app.documents[0].pages.length; p++) {
         var frames = app.documents[0].pages[p].textFrames;
         var pdf_name = null;
         for(var i = 0; i < frames.length; i++) {
              if(frames[i].paragraphs[0].appliedParagraphStyle.name == 'test') {
                   pdf_name = frames[i].paragraphs[0].contents;
                   break;
         if(pdf_name != null) {
              app.pdfExportPreferences.pageRange = app.documents[0].pages[p].name;
              var export_preset = app.pdfExportPresets.item("[Smallest File Size]");
              app.documents[0].exportFile(
                   ExportFormat.pdfType,
                   File("/" + pdf_name + ".pdf"),
                   false,
                   export_preset

  • Export Tags for Paragraph styles in Indesign CC without classes

    With CS6, when you set export tags for para styles, you could export them to epub without classes, for example body text as p, headings as h1 or h2 etc - without need for classes. This made very simple code. With Indesign CC, it seems that classes always get added no matter what. So all your body text is tagged with p with a class of normal or something. Is there a way to go back to setting export tags as straight p of h1, h2 tags??

    Nope. It was an intentional change on our part for CC.
    I do understand there are a number of folks who would like the option to do this on a per Style basis and I'm very actively considering it for a future CC update.
    Douglas Waterfall
    Architect, InDesign Engineering

  • How do I create a new paragraph Style in Pages for iPad?

    I opened an RTF document in iOS 6 Pages for iPad. How do I create new paragraph Syles?

    Style is a function of the template applied to the document (and/or the limited number built in to Pages). You can mofify the text or apply one of the built in styles, but I do not beleive within Pages in iOS you can create a new style.
    http://help.apple.com/pages/ipad/1.6.1/

  • Automatically create Object, Character & Paragraphs style when you copy & paste the same item.

    InDesign could create styles automatically. If I am copying and paste an object or paragraph - that means I will be using it in multiple pages and consequently be making changes to it. I know I can always create a syle for all my elements, but having that feature build-in would be great. Especially for the designers like me who works on small documents. Great Forum!
    Thanks!

    InDesign make it really easy for you to create styles. I just believe that having it as an automatic feature (of course, an optional feature) would save time when working in small - mini publications, where there is really no need to create syles . Just my thought.

  • Photoshop CS2 Create Layer from Layer Style workaround?

    In newer versions of Photoshop I have created a layer from a layer style so I could edit the layer style directly .  Any way to do this in CS2? Workaround or equivalent?

    You can do the same thing in photoshop cs2
    Layer>Layer Style>Create Layers
    Or right click on the fx to the right of the layer thumbnail that has the layer style for the same options

  • How to delte empty Style Group from paragraph style palette

    Hi Guys,
    I want to delete my empty paragraphStyleGroups folder that are Style Group 1and Style Group 3 (see pic) from my palette.
    I need a js code for this task.
    I have created script but it deletes all the Style group from my panel.
    Here is the script:
    myDoc=app.activeDocument;
    myStyleGroup=myDoc.paragraphStyleGroups;
    for(p=0;p<myStyleGroup.length;p++)
    myStyleGroup[p].remove();
    Please suggest!
    Chang

    You are awesome man.
    It is working as I need. Thanks again Kasyan.
    Regards,
    Chang

  • Exporting text only from specific paragraph style

    Hi,
    Is there a way to export text from Indesign to txt or preferably Excel from specific paragraph style ? I am trying to export only item numbers and prices to excel spread sheet so I can compare against original excel spreadsheet.
    Thank you !

    Not built in, no. But you could do this:
    Create a new paragraph style called "Delete Me". In the paragraph styles
    palette, select all the paragraph styles you're NOT interested in.
    Delete them in one go, and replace them with "Delete Me."
    Now, in the find/replace box, search for "Delete Me" and replace with
    nothing. This will cause all the paragraphs that have the "Delete Me"
    style to be deleted.
    Now what remains in your document is only the text that you're
    interested in.
    Ariel

Maybe you are looking for

  • Mcbook Pro (2009) freezing all the time. Bootcamp windows works perfectly...

    Hi, I'm very confused. I've had my macbook pro for 2 years now, with bootcamp Windows installed for almost that long without a problem. As of today my macbook keeps locking up everytime I click on an application or click my mouse on something. It fre

  • Status Field in Qualifications Window (HR Module)

    Hi All, What is the name of the lookup linked with 'Status' Field in 'Qualifications' Window? Thanx in Advance,

  • Document creation statistic data

    Hi, I've been task to create report that will show some kind of statistic about document creation, by date, username etc in our ERP system. First thing I came up with is to pull documents header data and count them in query designer. I know i need da

  • Not able to do Pegging for both MPS & MRP Workbench

    Hi Experts, We have implemented SCP (Oracle EBS 11.5.10.2). Loaded the forecast, then ran the MDS. Also ran the MPS (for finished goods). Later opened the MPS workbench, cannot see items for pegging. Please do the needful. Thanks.

  • Newbie Question: Correlation when no matching elements exist

    I have a request with an order number that gets sent to another BPM for a lookup. If the order number exists, the called BPM responds with returnCode=0 and the list of order contents (along with the order number). However, if the order number does no