How to map para style by script

Hi
My indesign file has already some Group style, when I try to flow the XML file in Indesign that time same style of paragraph are not mapped with automatically. FYI
Here 'TXT' style is already defined in 'Chapters' Group style (see Part A). After flowing again 'TXT' (see Part B) is coming in without mapping.
Now I want to map the 'Part B' style with 'Part A' is this possible by script?

Hi
I have used this code but its showing errors
_mappingStyle("TXT", "Chapters", "Chapter_Title") 
_mappingStyle("TXT", "Chapter_Title") 
function _mappingStyle(findStyle, changeGroup, changeStyle) 
    app.findGrepPreferences = app.changeGrepPreferences = null;   
    app.findGrepPreferences.appliedParagraphStyle = findStyle;   
    app.changeGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item(changeGroup).paragraphStyles.item(changeStyl e);    
    app.activeDocument.changeGrep();     
    app.findGrepPreferences = app.changeGrepPreferences = null;   
by hasvi

Similar Messages

  • How to Map the styles in indesign

    I have updated certain styles in template now I need to updated those styles in source indd file.
    Do we have any way to map the styles or do we can replace the styles from one indd doc to another is there possible.
    Otherwise do we have any other simplest way in indesign.
    I have to replace more than 30 to 40 documents.
    Then it take so long time.
    Is there any script to make it soon.

    REMO1980 wrote:
    The actual probs is I need to replace only the style naming not the style.
    Example:
    In indd file the style name is "Title" I need to replace this style name to Chapter Title.
    Is this Possible in
    scripting?
    Yes its possible ....
    Check below code
    //rename paragraph style
    var myDoc = app.activeDocument;
    if (myDoc.paragraphStyles.item("Title") != null)
    myDoc.paragraphStyles.item("Title").name = "Chapter Title";
    But if you importing template style and your template style naming is different then your document stye. I think you can also use delete old style and replace with your new style.
    //delete and replace paragraph style
    if (myDoc.paragraphStyles.item("Title") != null && myDoc.paragraphStyles.item("Chapter Title") != null)
    myDoc.paragraphStyles.item("Title").remove("Chapter Title");
    Shonky

  • Help: apply different para styles to several consecutive paragraphs via script

    Hi all,
    I need to apply different para styles to several consecutive paragraphs via script, something like this (found somewhere on the net):
    var myDoc = app.documents[0];
    var mySel = app.selection[0];
    var myPStyle1 = "A";
    var myPStyle2 = "B";
    //need to add 6 more styles here:
    //var myPStyle3 = "C";
    //var myPStyle4 = "D";
    //var myPStyle5 = "E";
    //var myPStyle6 = "F";
    //var myPStyle7 = "G";
    //var myPStyle8 = "H";
    //the last style not needed in script?
    // apply 1st style to 1st paragraph
    mySel.appliedParagraphStyle = myDoc.paragraphStyles.item (myPStyle1);
    // apply styles to paragraphs after selected
    //2nd style
    mySel.paragraphs[-1].insertionPoints[-1].appliedParagraphStyle = myDoc.paragraphStyles.item (myPStyle2);
    //next style
    mySel.paragraphs[-1].insertionPoints[-1].paragraphs[0].insertionPoints[-1].appliedParagrap hStyle = myDoc.paragraphStyles.item (myPStyle2).nextStyle;
    I've tried badly, but can't find the way to extend the sequence
    Sorry, no skills in scripting yet...
    all styles have 'Next Style' option activated, but I can't use 'Apply style, then Next style' or Object styles, because I need four different sequences of those para styles:
    A-B-C-D-E-F-G-H
    A-B-D-E-G-H
    A-C-D-F-G-H
    A-D-G-H
    and I really don't want to create special clones of the same style for each sequence (Keep It Simple, they say ).
    I believe it can be done via four slightly adjusted scripts...
    any suggestions would be greatly appreciated...

    Sorry about being late to the party, I usually pick up stuff like this right away.
    How about this one?
    1. No separate scripts needed, it uses a tiny dialog where you can choose what style set to use. If I'm correct, you can press a number key on Windows to immediately select one of the items.
    2. It works down from the paragraph your cursor is in. It has nothing to do with text frames, though -- consecutive paragraphs inside a story always ignore any text frames.
    3. Extensible: you can easily change the names of the styles in the top array, and the number of style groups in the list.
    var styleLists = [
              [ "A", "B", "C", "D", "E", "F", "G", "H" ],
              [ "A", "B", "D", "E", "G", "H" ],
              [ "A", "C", "D", "F", "G", "H" ],
              [ "A", "D", "G", "H" ]
    var radiobutts = [];
    styleDialog = app.dialogs.add ({name:"Set Multiple Styles",canCancel:true});
    with (styleDialog)
              with (dialogColumns.add())
                        with (radiobuttonGroups.add())
                                  for (i=0; i<styleLists.length; i++)
                                            // Build radio button string
                                            str = "&"+String (i+1)+". ";
                                            for (j=0; j<styleLists[i].length; j++)
                                                      if (j) str += "-";
                                                      str += styleLists[i][j];
                                            radiobutts.push (radiobuttonControls.add({staticLabel:str, checkedState:false}) );
    radiobutts[0].checkedState = true;
    if (styleDialog.show())
              for (i=0; i<radiobutts.length; i++)
                        if (radiobutts[i].checkedState == true)
                                  break;
              if (i < radiobutts.length)
                        par = app.selection[0].paragraphs[0];
                        for (j=0; j<styleLists[i].length; j++)
                                  par.appliedParagraphStyle = styleLists[i][j];
                                  par = par.parentStory.paragraphs.nextItem(par);

  • How to make duplicate the para styles

    Hi,
    I have already created some set of styles for journal tempalte [E.g.: jNL,jUNL,...].
    Now I want to create same set of styles but starting with 'b' for book. [E.g.: bNL,bUNL,...].
    How to get duplicate 200 style names, but 'j' has to change 'b'.
    FYI:
    Is this possible by script?
    by
    hasvi

    I would strongly recommend to make organized styles, all depending on each other like a tree.
    So let's say make a basic para style, then create a folder (group) for the first style, depending on the basic. Name the folder J or Journal and the styles List1, List2, etc.
    When this group is complete, duplicate the folder (group) and rename it book. The styles have the same name, but are different in the group. This is easier to handle than to to rename each style.
    I do a similiar thing. I create a complete style sytem with groups and subgroups based on an outside basic style, but in the group is another basic style, this has the language German, when this group is complete, I duplicate it, change the name and change the basic style in the group to English, so I have the very same style name with a different language. In this basic style I adjust also language dependend GREPs, tracking or spaces should be wider in English because it needs less space normally, etc.
    It is easier to work with groups than with renaming the styles, and you get a very similiar result for using it.

  • How to insert the style in sap-script? and in smart form?

    how to insert the style in sap-script? and in smart form?

    Hi..,
    For SAP scripts u need to create them in SE72 ...
    and u can include them in the script editor as..
    /: STYLE <STYLE-NAME>
    P1 text...............  (*** P1 is the Paragraph format created in SE72 )
    /: STYLE *
    For smartforms u need to go for the transaction (tcode) SMARTSTYLES... here u can create paragraph and character formats globally...
    <b>Sunil, plz do remember to close all your threads, when ur problem is solved !!</b>
    reward all helpful answers,
    sai ramesh

  • How do I handle Style Groups in InDesign Scripting?

    Hi,
    I am relatively new to InDesign scripting.
    I'm trying to map Paragraph Styles to CSS, and it seemed to be working fine, till I came across Style Groups -
    Styles belonging to a group are identified as - Root Style Group name : Child style group name : ...... : Style name
    Because of this paragraph style  <Style name> was not mapping to the TOC style <Root Style Group name : Child style group name : ...... : Style name> and my TOC styles were not correctly mapping.
    I wrote a fix for this in my app, by fetching parent groups and appending to a string - which i check in the TOC style entries.
    Before calling this a FIX, I need to confirm if there are any more hierarchies/represnetations that could be used to represent a Paragraph Style as a TOC style? I don't want to see that a week later I discover something like <Style : Nested paragraph style> as a TOC style and then I'd have to fix my fix!
    Thanks.

    Hi,
    If YourPara is a paragraph style in myDoc and defined inside group of styles named myStGroup
    you can refer to it using:
    myDoc.paragraphStyleGroups.item("myStGroup").paragraphStyles.item("YourPara");
    Jarek

  • [JS] How to break link to paragraph style from script?

    I don't found the command break link to paragraph style from script.
    I want "unapply" the style from the text, but leave the formatting intact.
    Can help me?

    In the interface it's a separate command ("Break link to style"), but it seems in a script you have to use
    Paragraph.applyParagraphStyle (using:ParagraphStyle[, clearingOverrides:bool=true])
    You cannot use "null" or something similar for "ParagraphStyle", so I guess the idea is to use paragraph style #0 in your document (which is always "[No Paragraph Style]"). Be sure to set "clearing Overrides" to false, as it defaults to true.
    The following single line works on your current paragraph:
    app.activeDocument.selection[0].paragraphs[0].applyParagraphStyle (app.activeDocument.paragraphStyles[0], false);

  • Selecting particular range of style using script

    HI All,
    Can anyone suggest me that how we can select the range of text using script.
    I am having some different para styles say for eg., PS1, PS2, PS3, PS4...........
    I may applyed these styles in some jumping order but except PS1, now I want to select paragraphs with applied style PS1 to stop before the next appearence of PS1 style.
    Like: In a document Para 1, 10, 14, 25 were applied with PS1, so the selection should go in the way like 1-9, 10-13, 14-24 and so on
    Regards,
    love_all

    "The" index of a paragraph is nothing special, it's the index of the first character of that paragraph inside its parent story. In particular, it does NOT tell you "this is the 5th paragraph" or something like that.
    This is because "Paragraph" is an artificial construct inside "Text", not a truly existing first class object. Same as "Line", "Word", "Character", and indeed, any text selection at all.
    Since you already have a "found text" array, "the index" of the nth entry's paragraph -- with the constraint described above -- can be simply found by using foundText[n].paragraphs[0].index (the index of the first character of your foundText is foundText[n].index).
    If you DO need to know the nth number of the paragraph, search this forum. I think Peter Kahrel answered to a post to answer that exact question.

  • How do I use a Java script in place of a standard link?

    Hi! I'm very new to html and totally unfamiliar with Java. Basically my html has a link like this: Mr Nobody and I didn't like how easy it was for spammers to harvest that email address from my website. I looked at this site http://www.bronze-age.com/nospam/ which allowed me to download a javascript .js file and some instructions on how to recode my email link so that it's hidden.
    I've loaded the java procedure in the head of the html just like the website says. He says that every link must be converted to a script call; so what previously was Mr Nobody changes to <script>mail2("nobody","fake.address9z",0,"","Mr Nobody")</script>. What does this mean? I replaced the stuff from the inside of the quotes in the href and weird stuff happens. What do I actually replace or how do I call up this script?
    I basically have created an image mapped link that I want to call this javascript when clicked.
    thanks for any help!! :)

    cotton.m wrote:
    BigDaddyLoveHandles wrote:
    cotton.m wrote:
    BigDaddyLoveHandles wrote:
    cotton.m wrote:
    BigDaddyLoveHandles wrote:
    nclow wrote:
    BigDaddyLoveHandles wrote:
    nclow wrote:
    Beats me. Read the documentation. Or ask on a javascript forum, but they'll probably tell you the same thing.Yeah, they're all a bunch of ASCII porn lovers.Really, who isn't?!Even the sounds of an impact printer pounding out a solid page of characters gives me a thickie.Well actually... unless you're in the habit of using mustard during foreplay, and really who can tell, then I think that's actually one of them cd-rom hotdogs that you dropped in your lap.Is it too late to mention what a cultured and sophisticated person I am?If by cultured you are referring to bacterial growth between your toes then yes I think we covered this.It's just that I'm still holding out for that sponge bath from Fiest.Well if she ever gets off Bravo I'll send her your way.
    But not on the train. Yikes!Sigh... It's just that I've got that big guy's weakness for bony women...

  • How to change the Default login script and the USER login script in Netware3.12

    I need to cut down the disk map from Neware 3.12 in Win98 client's PC.
    please tell me
    how to change the Default login script and the USER login script in
    Netware3.12 ?
    Or is there any other ways to do this thing?
    Thanks a lot!

    On 4/6/2006 [email protected] wrote:
    > how to change the Default login script and the USER login script in
    > Netware3.12 ?
    Please repost in the discontinued.forums.
    Edison Ortiz
    Novell Product Support Forum SysOp
    (No Email Support, Thanks !)

  • How to create a barcode in scripts and smartforms

    hi
    how to create a barcode in scripts and smartforms

    Hi,
    For Script:
    A barcode solution consists of the following:
    - a barcode printer
    - a barcode reader
    - a mobile data collection application/program
    A barcode label is a special symbology to represent human readable information such as a material number or batch number
    in machine readable format.
    There are different symbologies for different applications and different industries. Luckily, you need not worry to much about that as the logistics supply chain has mostly standardized on 3 of 9 and 128 barcode symbologies - which all barcode readers support and which SAP support natively in it's printing protocols.
    You can print barcodes from SAP by modifying an existing output form.
    Behind every output form is a print program that collects all the data and then pass it to the form. The form contains the layout as well as the font, line and paragraph formats. These forms are designed using SAPScript (a very easy but frustratingly simplistic form format language) or SmartForms that is more of a graphical form design tool. 
    Barcodes are nothing more than a font definition and is part of the style sheet associated with a particular SAPScript form. The most important aspect is to place a parameter in the line of the form that points to the data element that you want to represent as barcode on the form, i.e. material number. Next you need to set the font for that parameter value to one of the supported barcode symbologies.
    The next part of the equation can be a bit tricky as you will need to get a printer to print that barcode font. Regular laser printers does not normally print barcode fonts, only specialized industrial printers that is specifically designed to support that protocol and that uses specialized label media and heat transfer (resin) ribbon to create the sharp image required for barcodes.
    Not to fear though, there are two ways to get around this:
    - You can have your IT department do some research - 
    most laser printers can accept a font cartridge/dimm chip (similar to computer memory), called a BarDIMM that will allow a laser printer to support the printing of barcodes.
    - Secondly, you can buy software that you can upload in your SAP print Server that will convert the barcode symbology as an image that will print on a regular laser printer. I found that this option results in less sharper barcodes. This option is really if you need to convert a large quantity of printers (>10) to support barcodes. 
    - Thirdly, you can buy a third party software like Barcode.dll and install on your frontend PC connected to the laser printer.
    Now you have a barcode printed - what next?
    Well there are two options, depending on your business requirements:
    - You can use an existing SAP transaction on a regular workstation and get a barcode wedge reader to hook up between the keyboard and the PC. These wedge readers comes in a wand or scanner format. There are even wireless wedge scanners available that allows you to roam a few yards from the workstation to scan a label. This approach is mostly used where you want to prevent human errors in typing in long material, batch or serial numbers in receiving or issuing of material. The problem is that it's just replacing the keyboard input and you are basically locked down in one location and have to bring all the material to that location to process.
    - Another solution is to use SAPConsole transactions
    or write your own ABAP Dialog programs that will fit onto a barcode enabled wireless handheld terminal and that will follow the business logic as executed on the shop floor. 
    These programs are highly complex exercises in industrial engineering and ergonomics because of the limited screen sizes and limited ability to accept keyboard input. The user is instructed step-by-step and only scan and push F-keys to interact with the SAP system. Scan, scan, beep, beep, enter - highly automated.
    For SmartForm:
    http://www.sap-img.com/abap/questions-about-bar-code-printing-in-sap.htm
    Regards,
    Bhaskar

  • How do I apply style within a text frame linked object

    I'm selecting the text frame in the object I want to apply an object style
    A script can be written
    within a text frame the linked object (selected text frame)
    how object style is applied

    Hi
    All you need is
    app.selection[0].appliedObjectStyle = app.activeDocument.objectStyles.itemByName ("Trevors Object Style");
    The below snippet will apply the style to all the anchored objects in the selection or document
    var doc = app.properties.activeDocument,
        myOnjectStyle = doc.objectStyles.itemByName ("Trevors Object Style"),
        myObjects, l;
    if (!myOnjectStyle.isValid) {
        alert ("Either add an Object Style Called:\nTrevors Object Style\nOr Make Significant Changes to The Script");
        quit ();
    app.findTextPreferences = app.changeTextPreferences = null;
    app.findTextPreferences.findWhat = "^a";
    myObjects = (app.selection && app.selection[0]).findText () || doc.findText ();
    l = myObjects.length;
    while(l--) myObjects[l].textFrames[0].appliedObjectStyle = myOnjectStyle;
    HTH
    Trevor

  • Can a DTD map custom styles to standard HTML tags?

    Hi,
    Every week the publishing house I work for has to manually copy the entire content of a weekly magazine on an article-by-article basis into an online database, the web version of the magazine. This means copying the styled InDesign content and inserting it into the database as plain text, re-finding all those italics (and any other styling) and putting it all back manually.
    I already know that I can create tags with all the basic HTML styles needed in the 'Tags' palette in InDesign, and then export that.
    The trouble is that when I re-import the XML file, I have to laboriously map the custom house-styles (there are many of them and they're boiler-plate, i.e. consistent, across all the magazine's InDesign styles) to the imported HTML styles.
    So here's my question:
    Am I wrong to believe that it's possible to create a DTD that would import not only the HTML tags but their relationship to the existing, custom-named InDesign tags that are common to all the magazine's documents?
    As an InDesign wish-feature, what's missing from the 'Tags' corner-menu is 'Export DTD' - if that was available, I could map the whole relationship between Indesign Styles/HTML styles just one time and later import the DTD on other articles; which would tell the Structure View how to convert our custom house-styles (both Paragraph Styles and Character Styles) into HTML tags and cut this time-consuming task in half.
    Thanks!
    EDIT: I perhaps should have mentioned that obviously the final stage after this 'dream conversion' is to export the XML from the Structure View. Then I can just open the saved XML file and paste it into the CMS with formatting intact.
    Added extra explanation of the workflow.

    geekbelief wrote:
    Googling XSLT and InDesign, it seems that such a stylesheet, if I were to create it, possibly couldn't handle spaces in the original InDesign style-names..? If anyone knows that for a fact, I'd be glad to be aware of it before starting down a long path to a roadblock.
    That's a good question. Let's find out together, shall we. I just created a text frame with Lorem Ipsum text, and created "a style" (with space) and "bstyle" (without). Now ... Map Style to Tag doesn't work, presumably because the tags don't exist and I assumed this would *create* them. And if you create one, ID complains "tags cannot contain tabs or spaces". (So can you have a Tab in your paragraph style name then? Gosh.)
    ... Forcing in a Non-breaking Space (#160) also doesn't work, this time ID simply says "A tag name cannot contain the character ' '."
    I think that's one you have to do manually.
    geekbelief wrote:
    I'm guessing that if I wanted to change the InDesign style 'Subheader' into 'h2', that snippet of the XSLT would be like this...?
    <xsl:template match="Subheader"><h2><xsl:apply-templates /></h2></xsl:template>
    Yeah, that's the correct syntax. But you cannot use an XSLT for mapping InDesign styles to tags. The process as I described works when importing your XML into InDesign, and changes the tags in the XML file to match InDesign styles. That's the other way around.
    I don't expect anyone to write this for me, but any hints or links to tutes that I haven't yet found would be appreciated!
    For a simple one-to-one translation of tag names, you can use this all the way. You only need any other XSL command if you want to do more than simple translation, such as filtering, moving, combining, or separating tags or their contents.
    There are lots of good tutes on the 'web for XSLT, although it seems interest has diminished lately. Half a decade ago XSLT was "hot"; nowadays the iPad is. Is there any news on improvements for ID's native XSLT support in CS6? I dare bet there are none at all -- it's already been deemed "yesterday's technology" by Adobe's Dev Team, just as Flash was discarded per CS5.5. I'm sure next year DPS will follow; and the year after that EPubs will be gone for good as well, replaced by holograms, transmitted live from your local library.

  • Mapping FM styles in RH7

    I am using RH7 in the Tech Comm Suite and cannot figure out
    how to map the FrameMaker style to styles I have created in a
    custom style sheet. The list in the Style Mapping window always
    defaults to the default.css. How can I get the list from my custon
    style sheet to show up there??? There is nothing about this in the
    RH online help.
    I don't have much prior experience in RH so this might seem
    like a basic question to some.
    ~Kim

    Well, when RH creates the topic(s) that corresponds to the
    framemaker file, it also creates a separate css file for EACH fm
    file that it imports. Each .ccs file has a name that corresponds to
    the FM file name. It appears to use the mappings you specify but
    also creates other styles that it uses. If you also use other
    custom styles (like for links), those are not added to the
    individual css files that RH creates (making it difficult for your
    site to have a consistent look and feel). I've been working on this
    for several days, trying to find an optimum way to do it, and it is
    a real pain as far as I'm concerned. (It's also driving me crazy
    the way it codes the html for lists, but that's another story...)
    One thing I'm trying now is to create a template for my RH
    files, and have a custom fmstyles.css file that is used by it.
    Then, in the Topics list, I select all topics at once, and then
    apply this template to all (via "Properties" in the context menu).
    That results in my custom css file being linked to all the topics,
    rather than the individual automatically generated ones. Of course,
    if I do an "update" on any of my topics generated from FM files,
    then that application of the template will have to be done again.
    Hope this helps,
    Linda

  • JS: Finding & replacing a character with a certain para style

    I'm scripting an automated indd -> PDF project and I need to minimise the user input.
    To this end, I want to search and replace commas in a particular cell of a table (which are the only instances of a particular para style), and replace them with forced line breaks.
    The script I have for another part of the XML import looks like this:
    //Search the document for the umlauts and replaces them with macrons. I
    app.findTextPreferences.findWhat = "Ï";
    app.changeTextPreferences.changeTo = "Ī";
    myDocument.changeText();
    What do I add to a similar script to make it target only content whish has a particular para style? And will it be compatible with CS4, 5 and 5.5, i.e. be agnostic to nested styles etc?
    Thanks in advance,
    Simon.

    Use app.findTextPreferences.appliedParagraphStyle:
    app.findTextPreferences.appliedParagraphStyle = "my_style";
    .. your snippet here ..
    I bet there is a reset somewhere above your snippet:
    app.findTextPreferences = null;
    app.changeTextPreferences = null;
    and it would be safest to insert this as well below your code, or else this particular setting will "stick" and also be applied to following replaces.
    This command is virtually unchanged since CS3, CS4? So far it seems to work in every version since then. But either way it's inconsequential to your nested styles, as these can only be character styles.

Maybe you are looking for

  • I have a new iTunes account, on a new computer. How can I get all my old music on my iPhone?

    I recently received a new laptop for christmas, so I wanted to use my own apple account on my iPhone. How would I get all the music/apps from the old library and account onto my new library account?

  • Byte array in JSON reply

    Hi guys, I'm exchanging some data between .net webservice and flex with JSON. This is a JSON reply: <string> {"uid":"23","photos":[[255,216,255,224,0,16,74,70,73,70,0,1,1,1,0,72,0,72,0,0,255,219,0,67 ,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12,20 </string> It

  • New tweens and resizing the stage: Help!

    Hi all. I'm going nuts trying to figure this out. I built an animation project at 630 pixels wide. Turns out the project needs to be 430 pixels wide. In CS3, using the classic tweens, I would simply resize the stage, Onion All, then resize everything

  • Verify an email has been read

    I recently sent some emails which looked like they had been sent (they were in my sent box and I did not receive any "delivery faiure" notice) only to be told later that the mail had never been recieved. Is there anyway to verify a mail has been reci

  • Movement in flash

    I have not long purchased Adobe web premium CS3. I am trying to build a full flash site and would like to know the following: 1: How can i make lines or a square say 650 by 400 to move from left to right at a speed i want the same with the lines. te