[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

Similar Messages

  • InDesign crash while applying character style

    Hi all,
    A)I have problem with applying character style to selected text.
    when character style is applied to selected text indesign get crashes.
    my code snippet is as follow
    input parameters
    1.RangeData paraRange // start and end index of paragraph
    2.storyUIDRef // uidref of current story
              code snippet
              // valid text model
              InterfacePtr<ITextModel> textModel(storyUIDRef, UseDefaultIID());
              if (!textModel)
       break;
              //wax strand
              InterfacePtr<IWaxStrand> waxStrand(((IWaxStrand*)textModel->QueryStrand(kFrameListBoss, IID_IWAXSTRAND)));
              if (waxStrand == nil)
       break;
              //WaxIterator
              K2::scoped_ptr<IWaxIterator> waxIterator(waxStrand->NewWaxIterator());
              if (waxIterator == nil)
        break;
              //first wax line of paragraph
              IWaxLine* waxLine = waxIterator->GetFirstWaxLine(paraRange.Start(nil));
              //iterate each waxline
              while (waxLine != nil && (waxLine->TextOrigin() < paraRange.End()))
        //Iterate for all runs
       K2::scoped_ptr<IWaxRunIterator> waxRunIter( waxLine->QueryWaxRunIterator() ) ;
       IWaxRun * waxRun = waxRunIter->GetFirstRun();
       while (waxRun)
       int32 startPos  = waxRun->TextOrigin();
       int32 endPos = startPos + waxRun->GetCharCount();
       RangeData textRange(startPos ,endPos);
       ISelectionManager* selMgr = m_activeContext->GetContextSelection();
       if(!selMgr)
        break;
       //get valid textselection suite
      InterfacePtr<ITextSelectionSuite> suite(selMgr, UseDefaultIID());
                                  if (!suite)
       break;
                                  //select  text
      suite->SetTextSelection(storyRef, textRange, Selection::kScrollIntoView, nil);
                                  //created style from selection using  " SnpManipulate::TextStyleCreateStyleFromSelection" method.
    my code get crashed at highlighted text( int32 startPos  = waxRun->TextOrigin();).
    B)my next question is how to get textstyle ranges of a selected paragraph.
    please help me.
    Thanks
    Tahir

    A) Make sure that the all parcels of the text is composed before you iterate it, see ITextParcelListComposer. I don't quite understand what you are trying to achieve. You want to apply a character style to a range of text, but the code iterates wax lines and iterate the runs of each line  and sets the current selection to be the run on each iteration. Why not just:
    InterfacePtr<ICommand> icmd(textmodelCmds->ApplyStyleCmd(index, length,styleUID,kCharAttrStrandBoss,kFalse));
    B) Walk the kCharAttrStrands to the get information:
    InterfacePtr<IStrand> strand((IStrand*)textmodel->QueryStrand(kCharAttrStrandBoss,IStrand::kDefaultIID));
    then call stand->GetRunLength() a number of times until, you are through the selected part of the text / paragraph

  • Having problem with applying layer style "stroke" to group

    - Windows 8.1 / 64bit
    - i3-4150 / 4GB / Geforce GTX 750 TI
    - Photoshop CC 2014
    Hi!
    I don't know why, but there is some problem that applying layer style "stroke" to group.
    When i make a group with some layer and apply to group a layer style-stroke with inside option,
    the strokes looks like grid are generated inside.
    Why i said that stroke cross to ㅎrid, because it looks like grid if i make that group bigger.
    (that black square is 'Rectangle 1' layer. Just resizing bigger than before)
    Does anyone have same problem with me?
    Please, I need your help..

    pillfish wrote:
    I am having the same problem. it happens every time in cc and cc 2014. I am back using cs6. Which seems to run better on the whole.
    That's interesting. And this is happening with CC and CC 2014?  Do you have all the updates for the Photoshop CC versions?
    I've just tried to duplicate it without success, (windows 7, GTX570) so I wonder if there is a condition that triggers it?  Unfortunately, with this being such an old thread, the only person still around is R Kelly.
    OK, I just thought to try it on my Cintiq Companion 2, which has Windows 8.1 and Intel 5100, and the bug occurred. I actually got as far as firing up my Win 8.1 laptop before remembering that I had to sign out of CC to put it on my Cintiq, so I only have CS6 on it.
    Anyway....  looks like the bug is still there.  Are you using Win 8.1?

  • Getting ALL applied Character Styles in a paragraph

    I'm trying to get all applied Character Styles of a paragraph in a InDesign CS2 Document.
    With myParagraph.appliedCharacterStyle I just get the first but not all applied Charcter Styles.
    Is there a possibility to get them?
    greets
    st

    If they're applied directly and not by nested style, then you should examine the appliedCharacterStyle of each TextStyleRange in the paragraph.
    If they're applied by nested style, you have to do a lot more work.
    Dave

  • Applescript-Apply Character Style to Select Words in InDesign CC

    I'm trying to apply a character style to the first several words of a paragraph. The number of words varies, but it is essentially every word before a comma.
    Here's what I have so far:
    tell application "Adobe InDesign CC 2014"
      tell document 1
      tell page 2
      tell (item 1 of page items whose label is "HabitsContent")
      tell paragraph 2
      repeat with i from 1 to count of characters
      if contents of character i = "," then
      exit repeat
      end if
      end repeat
      set applied character style of characters 1 thru i to "Italic"
      end tell
      end tell
      end tell
      end tell
    end tell
    Viewing the log of the script, it finds the comma; however, the script ends up italicizing the entire paragraph. Any ideas?

    For anyone else who has a similar question, here's what works:
    tell application "Adobe InDesign CC 2014"
    tell paragraph 2 of (item 1 of page items whose label is "HabitsContent") of page 2 of document 1
    set a to paragraph 1 as list
    set a to text item 1 of a
    set old to AppleScript's text item delimiters
    set AppleScript's text item delimiters to {","}
    set font style of characters 1 thru (count of text item 1 of a) to "Italic"
    set AppleScript's text item delimiters to old
    end tell
    end tell

  • Character '$' is not allowed in an XML tag name. /ERROR

    Hi,
    I was testing cli command java OracleXML getXML ....
    getting following error result:
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: Character '$' is not allowed in an XML tag name.</ERROR>
    This was because the database column name included $ characters.
    Question 1: Is it possible use getXML/putXML cli operations for tables containig these $ columns
    and how?
    Now I found the method setSQLToXMLNameEscaping(true) and tried the same query using the modified
    sample java code of XSU documentation. This time I got error result:
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: You are using an old version of the gss library; thus, sql-xml name escaping is not supported.</ERROR>
    Question 2: What is this gss library and is there up-to-date version available - and will it solve my
    $ problem?
    Thanks,
    Olavi

    Hi,
    I was testing cli command java OracleXML getXML ....
    getting following error result:
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: Character '$' is not allowed in an XML tag name.</ERROR>
    This was because the database column name included $ characters.
    Question 1: Is it possible use getXML/putXML cli operations for tables containig these $ columns
    and how?Please use alias in your SQL query for the column with $, like
    select sys$rowno_info as rowinfo..OK for getXML but how to do this with putXML?
    Now I found the method setSQLToXMLNameEscaping(true) and tried the same query using the modified
    sample java code of XSU documentation. This time I got error result:
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: You are using an old version of the gss library; thus, sql-xml name escaping is not supported.</ERROR>
    Question 2: What is this gss library and is there up-to-date version available - and will it solve my
    $ problem?gss libs is ithe nls_charset12.jar located in jdbc/lib.
    Olavi
    I added nls_charset12.jar dated july 2002 into my classpath without
    success?
    Olavi

  • When I start Firefox, I get this alert message "[JavaScript Application] XML tag name mismatch (expected META)". What is this message?

    My firefox updated today automatically, and then when it started up, it displayed this alert message:
    "[JavaScript Application] XML tag name mismatch (expected META)"
    I can press OK and my browser then works just fine and I can go to websites and what-not. I have not run across any problems or anything. I am just wondering what this alert message means and if I should fix it?
    I tried closing the browser and pulling it back up, and the same message was displayed. Also, if I open a new window the same message is displayed. But it is only displayed right when I open the browser, and does not show up anytime while using the browser.

    If you click the Home button from another page, does the error repeat? If so, what is your home page?
    When Firefox starts, it fires up a lot of add-ons. A standard diagnostic for add-on issues is to try Firefox's Safe Mode.
    First, I recommend backing up your Firefox settings in case something goes wrong. See [[Backing up your information]]. (You can copy your entire Firefox profile folder somewhere outside of the Mozilla folder.)
    Next, restart Firefox in Firefox's Safe Mode ([[Safe Mode]]) using
    Help > Restart with Add-ons Disabled
    In the Safe Mode dialog, do not check any boxes, just click "Continue in Safe Mode."
    Do you still get the message? If not, one of your add-ons might not be fully compatible with Firefox 14 or might need an update.

  • [JS][CS3]Applying Character Style to First Word

    I am a noob as far as Javascript  is concerned, and I was hoping for a little guidance.
    Here's my scenario: I have a book that has been typeset all in one file; the main content is all in one story. I want to select the first word of every text frame on each page and apply a character style. My goal is to utilize this character style to indicate page breaks in the XML--I'll map the style to a specific tag.
    So far I have this poor specimen:
    var myDocument = app.activeDocument;
    var myPage = myDocument.pages.item(1);
    var myTextFrame = myPage.textFrames.item(0);
    if( app.activeDocument.stories[0].paragraphs[0].words[0] != null )
    myTextFrame.paragraphs.item(0).words.item(0).appliedCharacterStyle =
    myDocument.characterStyles.item('foo');
    I know, I haven't set up any sort of loop yet (which will be trickier given the fact that there will be blank versos, etc). What I'm trying to do in this is to select the first word in the first paragraph on the second page--which it does in fact do. Problem is, the first paragraph on the second page starts on the first page, so I'm selecting that a word on the first page, not the second page.
    As I said, lots of work to do but a little help on getting to the right word would be most appreciated.

    Well, you were on the right track, but testing 'myText' fails if there is no text frame on a page because it fails one line earlier
    >var myTextFrame = myPage.textFrames.item(0);
    just before this, you should test the number of text frames:
    if (myPage.textFrames.length > 0)
      ... your stuff ..
    Only use this if you are absolutely positive there is just a single text frame on each page! A slightly better way would be to always loop over each textframe:
    for (frames=0; frames<myPage.textFrames.length; frames++)
      var myTextFrame = myPage.textFrames.item(frames);
      ..etc.
    in which case you also don't have to test its length first (the loop will not be executed if there are zero text frames).
    [Techy] Since you have only one continuous story, an even better way would be to loop over the textframes of that story alone. You have to identify the story somehow, and I usually click the text cursor in the one I need:
    myStory = app.selection[0].parentStory;
    or you can rely on the fact that the story starts in the only text frame on page 1:
    myStory = app.activeDocument.pages[0].stories[0];
    (I think that oughta work.) Then, each frame of this story up till the end can be found in the array
    myStory.textContainers
    which are usually text frames. You can loop over these using
    for (frame=0; frame<myStory.textContainers.length; frame++)
      myTextFrame = myStory.textContainers[frame];
    ..etc.

  • InDesign erroneously applies character style to imported text

    For a year, I had been importing text into InDesign with little trouble until this problem starting happening and I can't figure out why.
    Let's say I have a CS3 file with defined character and paragraph styles.
    If I draw an empty text box, InDesign shows the character style "superscript" and paragraph style "ext_all" are applied. I can select "Break Link to Style," but if I import text into that box, the "superscript" character style is applied.
    The following happens whether I create a text box first or not:
    If I import a styled Word file, all the text comes in styled "superscript" until it reaches a Word character style.
    If I import an InDesign Tagged Text file, all the text comes in styled "superscript" until it reaches a character tag.
    If I import a very simple one sentence rtf file, all the text is styled "superscript."
    Anyone run into this? I've tried googling, but can't find a discussion about it. Thanks in advance!

    Perhaps you've inadvertently set those styles as the defaults? That would happen if you click on them with nothing selected. For the current document switch to the text tool and make sure there is no cursor active or text frame selected, then check to see that the character style is set to [None] and the paragraph style to what you would like to be your default. Also check the settings in the character and paragraph panels.
    To make sure this doesn't carry forward into any more new documents, if indeed that was the problem, close all documents and repeat the above steps. With no documents open your selections will become the defaults for all new work until changed.
    Peter

  • 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"));

  • With Grep SUPERSCRİPT apply character style

    I want the script with
    contained in document SUPERSCRIPT
    apply a character style
    app.findGrepPreferences = app.changeGrepPreferences = null;      
    app.findGrepPreferences.findWhat = Position.SUPERSCRIPT; //??
    //app.changeGrepPreferences.changeTo = "";
    app.changeGrepPreferences.appliedCharacterStyle = "myChar";
    app.activeDocument.changeGrep(); 
    app.findGrepPreferences = app.changeGrepPreferences = null;

    Try this,
    app.findGrepPreferences = app.changeGrepPreferences = null;     
    app.findGrepPreferences.position = Position.SUPERSCRIPT;
    app.changeGrepPreferences.appliedCharacterStyle = "myCar1";
    app.activeDocument.changeGrep();
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.position = Position.SUBSCRIPT;
    app.changeGrepPreferences.appliedCharacterStyle = "myCar2";
    app.activeDocument.changeGrep();
    app.findGrepPreferences = app.changeGrepPreferences = null;
    Vandy

  • How to write script to apply character style?

    Hi,
    I'm on a Macbook pro and without a number pad so I can't assign a shortcut for the character styles. I did hear of a roundabout solution where you can assign a shortcut to a script which applies the character styles. Can anyone write this script?
    My character style is called 'Features bold'.
    I'm new to scripting, sorry if this is a dumb question.
    Cheers

    Hi,
    1. Save this code as .jsx file inside your Script Panel folder
    2. Apply a shortcut using Edit:Keyboard shortcuts... menu
    Option to choose:
    suggest to choose an option "context": "Text", so you can use more shortcuts which are busy with other contexts.
    #target indesign
    if (app.selection && app.selection[0].hasOwnProperty ("baselineShift") ) {
      var cName = "Features bold";
      var mCstyle = app.activeDocument.characterStyles.item(cName);
      if (mCstyle.isValid)
           app.selection[0].applyCharacterStyle(mCstyle);
      else
           alert ("CharStyle: " + cName + " not found");
    else
      alert ("Some text supposed to be selected...");
    Jarek

  • Autogenerate XML tag names from other style palettes

    Map Styles to Tags works great when you already have a bunch of tags named identically to the other styles you want to map. Today, however,  I had to manually create and type in tag names to match about 25 paragraph styles. Ick!
    It would be really neat if you could select a bunch of styles in the Para or character Styles palettes and have a "Create Matching Tags" command that would automatically add tags matching those style names to your Tags list. No muss, no fuss, no typos.
    Thanks! The XML fuctions are mostly extremely cool!

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

  • [JS][CS4-5] Apply hyperlink to xml tagged object

    Hi,
    Can anyone please help me? I'm strugling with this problem for days....
    I'm trying to apply a new hyperlink to a xml tagged object (piece of text, frame or image)...
    The script trows an error "wrong source. Expected text but received XML element"
    Does anyone know how i can fix this?
    Thanks
    Code:
    var myDoc = app.documents[0];
    Check(myDoc.associatedXMLElement);
    alert("Done !");  
    //recursive function
    function Check(elm){
             for(var i=0; i<elm.xmlElements.length; i++){
                   myXMLElement = elm.xmlElements[i];
                   XMLelementName = myXMLElement.markupTag.name.toString();
                   // only apply to tagged object using the tag "Hyperlink"
                   if (XMLelementName == "Hyperlink"){
                          var myHyperlinkURL = myDoc.hyperlinkURLDestinations.add("http://www.google.com");
                          myHyperlinkURL.name = "http://www.google.com";
                          var myObject = elm.parent;
                          if(!( elm.xmlAttributes.item("href") == null)){
                                    // it's a picture
                                   // i'm not sure this will work
                                myHyperlinkSource = myDoc.hyperlinkPageItemSources.add(myObject);                 
                          }else{
                                   // it's not a picture
                                  // Error is in the line below
                                myHyperlinkSource = myDoc.hyperlinkTextSources.add(myObject);                 
                          var myHyperlink = myDoc.hyperlinks.add(myHyperlinkSource, myHyperlinkURL);
           // process all sub elements
           for (var i = 0; i < elm.xmlElements.length; i++){
                Check(elm.xmlElements[i]);

    Hi,
    Thanks for your feedback.
    Due to your great feedback, I've made some changes to the line below...
    var myObject = elm.texts[0];
    When performing the script, a hyperlink is added to all text in the textframe, not only to the text tagged by the xml tag. Does anyone know how this can be fxed?
    Also, when trying to do the same thing for  an image, but this doen't work...
    var myObject = elm.images[0];
    An error occures.
    And what about a empty graphic frame ? How can I add a hyperlink to frame if it's tagged by a certain xml tage?
    Any feedback would be helpfull...
    Tim

  • How to find the selection character is xml tag or not?(CS2-js)

    I have a xml tagged indesign document, when i select a tag in paragraph i cant able to find it as xml tag, it only shows me the character contents as small box, is there any way to find the selected item is xml tag or not ?
    thanks
    subha

    I have a xml tagged indesign document, when i select a tag in paragraph i cant able to find it as xml tag, it only shows me the character contents as small box, is there any way to find the selected item is xml tag or not ?
    thanks
    subha

Maybe you are looking for

  • Windows Home Server and Apple TV 2

    There are some old threads talking about Windows Home Server and the original Apple TV - the HP Windows Home Servers actually have excellent Mac support and out of the box with the Twonky Media Server that is bundled with the HP WIndows Home Servers

  • WM stock not acting as it should

    Hello, I hope you are all doing well I have a challenge that is proving very difficult to find the root cause. My WM stock situation is not acting as it should My current theory is that one of the t.o. update tables must be failing to update so the s

  • Pushpins not showing in preview and hence not showing on embedded map

    have imported KLM file OK after finding import only works in internet explorer but when i click share and look at preview the pushpins aren't  showing and the same when i embed into website just the base map . Have i missed a process ?

  • Best bluetooth card for early iMac G5 (2004)?

    I've recently bought an iMac G5 without a bluetooth module. My understanding is that the following bluetooth cards would work with my iMac are: -A1115 -A1044 I was wondering if anyone could advise me on which to buy? Is one better than the other? Tha

  • Control ESS Open Enrollment to use adjustment reason instead of open offer

    Hi : We would like to control open benefit enrollment with adjustment reason instead of standard open offer. Plans are configured for adjustment reason 'OPEN', IT0378 created for the ee with this reason, and open enrollment period is configured . I u