Tagging for Character Style

Hi All,
Need to insert tagging (character style name) surrounding the text which has character styles applied in InDesign document.
Example: This is <italic>an</italic> example of <bold>character style</bold> tagging text.
Please provide JS code for this.
Thanks in advance,
Mon

Hi,
    Try this. I'm also fresher...
First u have to create tags manually with names b, bi,i, sc (bold,bolditalic,italic, small caps)...
then execute this js...
docObj=app.activeDocument;
xmlObj = docObj.xmlTags;
pageObj=docObj.pages.item(0);
myTextFrame=pageObj.textFrames.item(0);
myText=myTextFrame.parentStory.paragraphs.item(0);
app.findTextPreferences = app.changeTextPreferences =  NothingEnum.nothing;
app.findTextPreferences.fontStyle = "Bold";
app.changeTextPreferences.markupTag=xmlObj[0].name;
alert(app.changeTextPreferences.markupTag);
app.activeDocument.changeText();
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.fontStyle = "Bold Italic";
app.changeTextPreferences.markupTag=xmlObj[1].name;
alert(app.changeTextPreferences.markupTag);
app.activeDocument.changeText();
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.fontStyle = "Italic";
app.changeTextPreferences.markupTag=xmlObj[2].name;
alert(app.changeTextPreferences.markupTag);
app.activeDocument.changeText();
app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.capitalization = Capitalization.SMALL_CAPS;
app.changeGrepPreferences.markupTag=xmlObj[4].name;
alert(app.changeGrepPreferences.markupTag);
app.activeDocument.changeGrep();

Similar Messages

  • Inserting HTML tag for character style

    I want to be able to use the <DEL> HTML tag around some text:
    <p>Regular Price <del>$395</del>  Today $95</p>
    So, it should look like this:
    Regular Price $395 Today $95
    This works reliably in Dreamweaver (both preview and in various browsers). It also works on this forum page! But I can't get it to work in Muse.
    Here is my test site:
    http://musetest-dec152012.businesscatalyst.com/index.html
    I followed the instructions here:
    http://forums.adobe.com/message/4819276#4819276
    This shows how to add a scroll box using HTML. That works on the test site. I then modified the contents to add <DEL> to the second word and it isn't shown. [I also added <STRONG> to the sixth word and it doesn't show either.]
    I followed the instructions here:
    http://forums.adobe.com/message/4399108#4399108
    This shows how to use a character style. The <MARK> style seems to work, but the <STRONG> style doesn't show up in the browser. Any rate, there is no way I can find to add my own tag and the <DEL> tag is not one of those in the pull down list.

    Iain --
    Muse overrides the default styling for the 'del' and 'ins' tags. If you want to use these tags in custom HTML, and have styling applied to them, you'll have to specify the styling you want with inline CSS, like so:
    <p>Regular Price <del style="text-decoration: line-through">$395</del>  Today $95</p>

  • 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

  • Conditional build tags with character styles and ignored text

    RoboHelp HTML v8.0.2.208
    Windows XP Professional Version 2002 Service Pack 3 with 2 GB of RAM
    Output: WebHelp and HTML Help
    I have recently moved my projects from RH HTML X5 to RH HTML 8 and this is when the following problem appeared. I use lots of conditional build tags within the help projects. Some of these tags are for my own use for reference and I combine these with character styles containing a coloured background (highlight) so that they show up in the WebHelp or HTML Help output (e.g. text to identify the software version that the field/feature/text was added, reminders to check details, insertion of bug ID numbers, design document names, etc.). These areas of text are stripped out of the final build for customers by using a conditional build expression.
    What I have noticed is that if a paragraph contains text with a conditional build tag applied AND that tagged text has a character style applied AND an unknown word within the conditional build tag is ignored (with the HTML tag <?rh-ignored text="word_to_be_ignored" ?>), saving the topic, closing it, then re-opening it shows that the conditional build text has stretched to the next conditional build tag, or to the end of the topic if there aren’t any other conditional build tags. This also happens by switching from Design View to HTML View. Note that this doesn’t happen if Ignore All is applied to the unknown word.
    This doesn’t just apply to projects converted from RH X5. I created a new test project in RH8 and the same behaviour was observed. Similar behaviour occurred very occasionally in RH X5 but that seemed to be down to HTML tags being nested incorrectly.
    The largest project contains around 1200 topics and with many hundreds of conditional build text areas this now causes a problem. I’ll probably have to locate every ignored word in an area of conditional text within each project, set it to Ignore All and then manually remove and re-apply the conditional build tags, unless someone can come up with something clever. Can anyone else replicate this and should it be logged as a bug?

    Hi Daggins,
    Thanks - that is good info to have. But as we all agree, that does take away from the point of single-sourcing.
    You aren't misunderstsanding exactly... I am doing all my conditional tagging in FM and it works like a charm in terms of the PDFs that I generate from FM, and even the conditionally tagged text in RH shows/hides correctly. The issue is I am also importing my index and TOC from FM... and even if I have an entire file in FM tagged as conditional (all the text is tagged as conditional, I don't know if you can tag a file as conditional), the file name as a heading it still appears in the RH TOC. There is no text... but in my view it shouldn't appear in the TOC either (it looks like just a broken link when I generate my online help) - this is not ideal.

  • Create XML Element Tag BasedOn Found Character Style

    Hi,
    Good Day!
    Basically I want to search only for character styles that contains "ntb-", that is why it is hard coded in my searchString variable.
    Although I was able to create XML tag based on selected character style, but it will always add/insert at the end of the parent XML element.
    Can anyone could help me how insert/add that element at the insertion point where the text is found?
    Thanks,
    --elmer
    var myDoc = app.documents[0];
    myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.POINTS;
    myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.POINTS;
    var charStyles = myDoc.allCharacterStyles;
    var foundStyles = Array();
    var searchString = String();
        searchString = 'ntb-';
    var tempName = String();
    var tempName1 = String();
    for(var i = 1; charStyles.length > i; i++){
       tempName = charStyles[i].name;
       tempName1 = tempName.toLowerCase();
       if(tempName1.indexOf (searchString.toLowerCase()) != -1){
           foundStyles.push (tempName);
    var myDialog = app.dialogs.add({name: "Convert Footnote Character Styles to XML Tags",canCancel:true});
    with (myDialog) {
        with (dialogColumns.add().borderPanels.add()) {
            with (dialogColumns.add()) {
                staticTexts.add({staticLabel: "Character style to search : "});        }
            with (dialogColumns.add()) {
                selCharStyle = dropdowns.add({stringList: foundStyles, selectedIndex: 0, minWidth: 175});
    var dialogShown = myDialog.show();
    while (dialogShown) {
        if (selCharStyle.selectedIndex == 0) {
            alert("Must have at least a character style to search!");
            dialogShown = myDialog.show();
            continue;
        } else {
            insertXMLTags(selCharStyle.stringList[selCharStyle.selectedIndex], selCharStyle.selectedIndex, "0");
            break;
    myDialog.destroy();
    alert("Finished!");
    exit();
    function insertXMLTags(cStyle, cStyleIndex, ip) {
        var myFinds = searchStyle(cStyle, cStyleIndex);
        for (i=myFinds.length - 1; i>=0; i--) {
            var myIP = myFinds[i].texts.item(0).insertionPoints.item(0);
            var myParentXML = myIP.associatedXMLElements[0];
            var myChiidXML = myParentXML.xmlElements.add ( cStyle );
            myChiidXML.contents =  myFinds[i].contents;
            //set the selection
            app.selection = myFinds[i].texts.item(0);
            //remove the selected text
            myFinds[i].texts.item(0).remove();
            Utility Functions         
    function searchStyle(cStyle, cStyleIndex){
        var myFinds;
        // if script version is for Indesign CS2
        if (app.scriptPreferences.version < 5){                                 
            app.findPreferences = NothingEnum.nothing;
            app.changePreferences = NothingEnum.nothing;
            myFinds = myDoc.search(undefined, undefined, undefined, undefined,
            {appliedParagraphStyle: pStyle, appliedCharacterStyle: cStyle});
        // else, for CS3 and CS4
        }else{                                 
            //Clear any existing find/change settings
            app.findTextPreferences = NothingEnum.nothing;
            app.changeTextPreferences = NothingEnum.nothing;
            // set character or paragraph style to search
            if (cStyleIndex != 0){ 
                app.findTextPreferences.appliedCharacterStyle = cStyle;
            //Set the find options.
            app.findChangeTextOptions.caseSensitive = false;
            app.findChangeTextOptions.includeFootnotes = true;
            app.findChangeTextOptions.includeHiddenLayers = false;
            app.findChangeTextOptions.includeLockedLayersForFind = false;
            app.findChangeTextOptions.includeLockedStoriesForFind = false;
            app.findChangeTextOptions.includeMasterPages = false;
            app.findChangeTextOptions.wholeWord = false;                             
            myFinds = myDoc.findText();
        return myFinds;

    Here is a way you can find any field.
    Download the current template.
    Open it in word and go to the line that you are interested in.
    The blanket PO# will be a field. Right click on it and go to properties. You will see the xml element there.
    Hope this answers your question,
    Sandeep Gandhi

  • Finding MANUALLY applied character styles

    Hi all,
    We're in the process of switching to an XML workflow, and as one of our interim steps we're applying tags to paragraph and character styles in some of our documents. I'm aware of the option to map styles to tags and this should work well for paragraph styles. However, we're looking for a way to only map the character styles that have been manually applied.
    As an example, we have a paragraph style for instructions that has a bold number nested at the beginning of each paragraph. In other places, the same character style may be used to bold a specific word, but it is applied manually. Is it possible to map to tags ONLY the character styles that were applied manually? We do not want tags identifying character styles that were applied via Nested Styles or GREP Styles.
    I am assuming this would take some sort of script, which is why I'm posting in the scripting forum. Does anyone know if this is possible?
    Thanks in advance,
    Matthew

    Another InDesign oddity!
    If you fill a frame full of placeholder text and assign a "Bold" character style to, for example, a Nested Style:1 word, and a GREP style \<\w{4,6}\>, then use regular (or GREP) Find Text to search for the character style, it'll only highlight words that are at the start of the paragraph. Now that is wrong, wrong, wrong, because
    (a) it should not find any of them -- if you click your cursor into one of these bolded words, the Character Style panel says it's [None].
    or
    (b) it should find all of them, not just those that happen to be at the start of a paragraph. (BTW -- it's not the Nested Style it picks up; when using only GREP styles it'll also find words-at-the-start).
    It is funny, if things like this tickle you, that in a script "findText" works exactly the same. However: if you 'found' bold text and then interrogate what character style it has applied, it will only return your "bold" style if it was applied manually.
    See this script -- test with a placeholder text, aforementioned Nested/GREP styles, and a few hand-picked words that you applied "bold" to yourself. It will only report the ones you marked.
    app.findTextPreferences = null;
    app.findTextPreferences.appliedCharacterStyle = "bold";
    list = app.activeDocument.findText();
    r = [];
    while (list.length)
         next = list.pop();
         if (next.appliedCharacterStyle == app.activeDocument.characterStyles.item("bold"))
              r.push (next.contents);
    alert (r.join("\r"));

  • Why can't I use character styles in my shared content?

    When I try to use a character style in a text box I've identified with a Content Tag, the character style gets applied to the whole text box as a paragraph style would.
    I can't even manually make a word bold without it making the whole paragraph bold.
    Is this a issue with Shared Content?
    I can't imagine I have to make a separate text box to make a bold word, right?
    Any suggestions?

    But I thought the whole point of shared content was that you could style it separately?
    When I draw a new text box on my phone layout and I click the tag for the text I want to share from my desktop layout it fills in the content without any styling.
    Read this tutorial:
    Adobe Muse Help | Working with Synchronized Text
    "With Synchronized Text, you can type common text once and maintain a consistent copy on multiple instances. If you want to edit the text, changing it once updates all instances of the text across your site. When updating text across all instances, Adobe Muse does not alter any style attributes associated with an instance."

  • Adobe Muse - Character Style Options

    I have noticed new options for character styles is there any information availbable on using these new options as the H1 / H2 tags etc are no longer available

    Hi
    You can refer to these documents :
    http://www.adobepress.com/articles/article.asp?p=1925239&seqNum=3
    http://www.lynda.com/Muse-tutorials/Creating-character-styles/89048/104757-4.html
    Thanks,
    Sanjit

  • Unable to reset some settings values in Character Style Options back to "inherited"

    Hi!
    First, unfortunately Paragraph Styles and Character Styles are not so cool as in InDesign in Photoshop. I hope it will be updated in future versions because good typography is very actual now.
    Here is one of issues:
    I can't set Font Family and Color in Character Style Options back to inherited ones, i.e. to reset/empty it. Onse I set some custom font/color for Character Style (manually or after "Redefine..") I can't remove it, only set new one. And since Character Style is another level of abstraction over Paragraph Style this behavior is very annoying - I always need to check what font is set up for characters, change it or even delete this character style and create a new one with same settings but default (empty) font family.
    Fortunately some other settings (font size, leading and all other inputs/selects with editable value) can be reset (emptied) - that's why I consider situation with font family/color as buggy/raw.
    What do you think about this? May be I don't know some secret tricks/technics to fix it?
    Thank you

    I purchased the same laptop from Wal-mart in late August, I have had nothing but problems. Going from one program to another within the computer takes forever, the pages constantly say "not responding", getting on the internet takes all day, anti virus software has been installed, scans have been run which might I add took three days to do because the computer kept freezing and I  had to manually restart. Un-installing programs is next to impossible as every time I start and sit and wait 10 minutes later I am still waiting, try to get out of the program and it won't let me. I try ctrl alt del which doesn't help. I took mine back to Wal-mart a week over the amount of time they allow for returns which is ridiculously short and they would not take it back. I have spent numerous hours trying everything under the sun to get this 2 month old computer to work and to meet up to my expectations of a brand new laptop computer and I am almost ready to chunk it out the backdoor. I am very disappointed in this product and will never buy another Toshiba. My family owns a Dell laptop and 2 HP laptops and we love them. This laptop was purchased for my children to do schoolwork as they are homeschooled and unfortunately they have not been able to do ANY! Take my advice, DO NOT BUY this product!

  • Unable to save paragraph and character styles

    I noticed an issue popping up for me in CS6 yesterday. I thought it was originally because of Fireworks saved PSD but an effort re-create the file from scratch in PS I'm coming across the same issue. In PS when I have a large amount of text layers and create a paragraph or character style, when I have ANY layer/group in my document locked I'm unable to save any paragraph or layer styles. Regardless of the layer or group being locked and regardless of what layer is highlighted I'm unable to save styles / any settings / name etc. The error I get for character styles for example is:
    "Could not complete the Modify Named Character Style command because a specified layer is locked."
    I did notice that in the Fireworks created PSD that without any layer even being locked I'd still get an error. It may be that this other document got some bad mojo from the Fireworks PSD. When creating a test doc and only creating a couple text layers and a bunch of empty groups and layers I'm unable to reproduce this. It appears to happen to me when I have a slew of text layers.
    Has anyone else experienced this and figured out a more solid workaround?

    If you want to add the styles to an already created document:
    1) Create you Character style containing only the character color
    2) Find and Replace, searching for text with red color and replace formatting with the new character style. (Don't type anything in the text part of the Find and Replace dialog)
    3) Create and apply your paragraph style to all. The text with the Character Style applied will stay red.

  • [CS3 JS]  Exchange Character Style Problem!

    Hello experienced JS people,
    The situation is as follows -
    I have a document that MAY have the Character Style 'A'.
    If this were to be true - then I'd like to exchange it for Character Style 'B'.
    Sounds simple doesn't it.... It's KILLING ME!
    This must be possible? The problem is - I don't know how!
    My scripting lookes like this so far:
    > app.findTextPreferences.appliedCharacterStyle = "File name";
    app.changeTextPreferences.appliedCharacterStyle = "Document No";
    oneDoc.changeText();
    Help would be greatly welcomed....
    Thanks in advance,
    Lee

    I think the problem is in the word "MAY".
    You need to have a test for existence:
    var styletofind = app.activeDocument.characterStyles.item("File name");
    if (styletofind != null) {
      var styletochange = app.activeDocument.characterStyles.item("Document No");
      app.findTextPreferences.appliedCharacterStyle = styletofind;
      app.changeTextPreferences.appliedCharacterStyle = styletochange;
      oneDoc.changeText();
    But even this might not be enough if the character styles in question are in groups.
    Dave

  • How to create new character styles in Numbers 3.0

    In Numbers 3.0, it is possible to update existing characters styles, but I cannot find how to create a new character style, the + sign in the popup is always inactive when I edit text in a cell. The paragraph style popup has an active +, but it doesn't work for character style.
    Is there any way to create a new character style?

    Guillame,
    You're right about not being able to add styles, and I have not figured out how to modify a predefined character style, other than to Rename or Delete a predefined style. I have added this to my list of things lost.
    Jerry

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

  • Tagging character styles and paragraph styles in inDesign

    I'm working on a complex book in which everything on the pages is styled.
    I've been asked to tag the vocabulary terms in the text, so that the correct page number shows up in the index.
    I've been asked to tag the folios as well, for the table of contents.
    The folios are a paragraph style.
    The vocabulary terms are styled with a character style.
    How do I do this?
    Any help much appreciated.

    InDesign's built-in Table of Contents function picks up text based on paragraph styles. I'm not sure you really men, though, that you want to pick up the folios, if you are using the term as I understand it, to mean the page numbers. You really want to pick up the various headings used to identify the topics or titles. ID will supply the page numbers.
    As for the indexing, there may be a script that can find text with a particular character style assigned and add it to an index (you should ask over in the scripting forum: InDesign Scripting) but you should also read the Help on Indexes and learn more about how they operate.

  • [CS5 JS] Problem in Applying character styles xml tag names

    Hi,
    e.g. 1
    <italic>This is a italic text with <sup>superscript value</sup></italic>
    e.g.2
    <sup>This is a superscript text with <bold>Bold superscript</bold></sup>
    <italic>  mapped to character style "italic" and
    <sup> mapped to character style "sup"
    In my java script I already mapped the xml tags to specific character styles. In some of the cases (see e.g.1 and e.g.2) I need to map it to other character styles.
    In e.g.1 I need to apply a new character styles "italicSup" for the text "superscript value" same way
    In e.g.2 I need to apply a new character styles "BoldSup" for the text "Bold superscript".
    Can any know how to do this?
    Green4ever

    FYI, I am using
    Win Xp-SP2, CS5 7.0.3

Maybe you are looking for

  • Getting started with WebLogic Portal 11g

    Please can someone provide links to get started with Oracle WebLogic Portal 11g.

  • Transferring photos from apple tv back to the imac

    My imac hard drive crashed and was just replaced. Our photos now only exist on our apple tv. What is the best and easiest way to transfer them back?

  • Smart form & show ( & )

    Dear all, I want to ask a question, if the material purchase order long text written &  and then if they are shown in smartforms will appear <(> & <)>. How to solve it.?? thank you Icuk Hertanto

  • How to put constraint??

    hi, 1st case i have a table ABC , in this i have 3 columns col1 col2 col3 now i want to put constraint on table level that col1 n col2 always b unique together like col1 col2 col3 100 1 item 100 2 item 100 3 item 200 1 item 200 2 item 2nd case i have

  • Can't edit effect parameters

    This just started happening today. I can't click on the effects symbol that edits the individual parameters for the effect. The window doesn't pop up. Any ideas?