Edit JS Script CS4 (Add XML Tags All pages automatically)

Hi, all Scripter
I have a javascript for add xml tags (ETMV2 Pearson, InDesign CS4).  We have select my powermath equation data then run script. Script automatically insert xml tags both side (open/close). But we select one by one then run script its time taking.
var d=app.activeDocument,
root=d.xmlElements[0],
ie = root.xmlElements.add("inlineequation", app.selection[0]),
im = root.xmlElements.add("inlinemediaobject", ie.texts[0]),
to = root.xmlElements.add("textobject", im.texts[0]);
to.xmlAttributes.add("role", "xpressmath");
Example 1: My powermath equation data (InDesign CS4)
[&x^{2}+y *frac*{1}{2x}&]
Select powermath equation data then run javascript below mention. Script insert xml tags.
<inlineequation><inlinemediaobject><textobject>[&x^{2}+y *frac*{1}{2x}&]</inlineequation></inlinemediaobject></textobject>
Its time taking and select one by one
Result:
My main concern is that is this possible script find open [& and close &] all poermath equation data automatically then insert (add) xml tags all pages.
Thank/Regard
snegig

Hi,
John Hawkinson thank you so much your suggestion.
I am new  this type of discusion (on this page). So i think anybody could not replay my answer. So i repost my question.
I want insert tags in my Indesign CS4 files. Is this posible when i select my powermath equaiton then run script. Script add tags automatically before/after my equation. Please ignore IDML word.
Yes i an comfortable with XSLT presently i working with Pearson ETMV2.
I have one more question when i past my snapshot its appear properly but when i agin see my commant then my snapshot disappear (see small blue rectangle).
Thank you John again i am new in this industry please guide.
snegig

Similar Messages

  • Add XML tag (all power math equation) after/before

    Hi all,
    I have JS code written by (Sir John Hawkinson "http://forums.adobe.com/thread/938603?tstart=90") its work fine. Actually script do add XML tags [&x+2&] after/before this power math equation.
    My problem when i run this script i am select matter (power math equation) one by one is that possible when i select few paragraph script add automatic xml tags select all "power math equation" matter.
    script code below:
    var d=app.activeDocument,
        root=d.xmlElements[0],
        ie = root.xmlElements.add("inlineequation", app.selection[0]),
        im = root.xmlElements.add("inlinemediaobject", ie.texts[0]),
        to = root.xmlElements.add("textobject", im.texts[0]);
    to.xmlAttributes.add("role", "xpressmath");
    Thank's
    Regard
    snegig

    Hello Sir,
    That time you suggest lots of possibility this script code. But 2 and 3 month i am very new in (InDesign, JS and my first jobs) so i have heavy workload so.
    I am really sorry once again could you any change/update this code.
    Thank you so much once again
    Regard
    snegig

  • Add xml Tags in Indesign CS4 by Apple/Java script

    Hi,
    All, I'm new to Indesign Scripting, and I'm hoping someone can help me with the following add xml tags in my xml indesign cs4 files.
    I have IDML (ETMV2) xml Indesign CS4 files. But i have lots of powermath equation without xml tags. So i want how i can insert xml tags.
    My probleam like this =>
    <no open xml tags>[&x^{2}+y_{3}&]<no close xml tags>
    I want like this (But i do manualy)
    <inlineequation><inlinemediaobject><textobject role="xpressmath">[&x^{2}+y_{3}&</textobject></inlinemediaobject></inlineequation>
    Can anyone write/suggest me how i can add xml Tags. By Apple/Java Script
    Any insight is appreciated!
    snegig

    Hi,
    John Hawkinson thank you so much your suggestion.
    I am new  this type of discusion (on this page). So i think anybody could not replay my answer. So i repost my question.
    I want insert tags in my Indesign CS4 files. Is this posible when i select my powermath equaiton then run script. Script add tags automatically before/after my equation. Please ignore IDML word.
    Yes i an comfortable with XSLT presently i working with Pearson ETMV2.
    I have one more question when i past my snapshot its appear properly but when i agin see my commant then my snapshot disappear (see small blue rectangle).
    Thank you John again i am new in this industry please guide.
    snegig

  • Add xml Tags by Apple/Java script

    Hi,
    All, I'm new to Indesign Scripting, and I'm hoping someone can help me with the following (add xml) problem.
    Can anyone write/suggest me how i can add xml tags. By Apple/Java Script
    My Probleam =>
    [&x+2, y+3&]
    Solution => (But its manual)
    <inlineequation><inlinemediaobject><textobject role="xpressmath">[&x+2, y+3&]</textobject></inlinemediaobject></inlineequation>
    I want add xml tags on my powermath equaiton. Its ETMV2 xml tags.
      Any insight is appreciated!
    Thank you so much
    snegig

    Hi John,
    (1) Without xml tags my InDesign file
    (2) After add tags my file (its manually)
    Is this any script when i select my power math equation data then add xml tags automatically
    Thank's any suggestion

  • Add xml tag to specific words in a text frame

    Dear all,
    I'm pretty sure this can't be too much of a hassle, but after hours of experimenting, searching and reading I can't seem to look at it from the right angle. I'm trying to find a way to search for a specific word ('Figure', in my case) in a given text frame, and add a corresponding XML tag to it automatically. I've found plenty of information on how to apply it to a page item as a whole, but from there no approach seems to work. Seeing as I'm fairly new to InDesign scripting, any nudge in the right direction would be an immense help.
    Kind regards and thanks in advance,
    Julian

    Hi Julian,
    Is this you asking?
    var doc = app.activeDocument;
    app.findTextPreferences.findWhat = "figure";
    var found = doc.findText();
    for(var i =0;i<found.length;i++)
            doc.xmlElements[0].xmlElements.add({markupTag:"figure", xmlContent:found[i]});
    Regards,
    Chinna

  • Need to add xml tag in the request message

    Hello Experts,
    Need ur help.
    Right now i am working on the scenario Http -> to -> Proxy.
    Whatever request i am getting is not having XML tag in it, and because of that my mapping is failing.
    Can you tell me that how can i add XML tag in my request so it will not fail in Mapping?
    Need to add : <?xml version="1.0" encoding="UTF-8"?> in request.
    Thanks,
    Hetal

    HI Hetal
    Instead of adding this to the source message. Remove this tag from mapping.
    Use a XSLT mapping without this initial tag. it will work.
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://namespace">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
    <xsl:template match="/">
    <xsl:for-each select="//tag">
    <xsl:value-of select="." disable-output-escaping="yes"/>
    </xsl:for-each>
    </xsl:template>
    </xsl:stylesheet>
    Use this mapping without
    <?xml version="1.0" encoding="UTF-8"?>
    If you still see XML tag then use
    <xsl:output method="html"
    instead of
    <xsl:output method="xml"
    Thanks
    Gaurav

  • InDesign crashes when I add xml tag

    I have some groups (image + text) inside text.
    When I try to add xml tags with a grep query InDesign crashes.
    If I try to manually add xml tag to the text in a group, for example "evitare l'umidità", InDesign give me a message error.
    I think it's a bug
    Here there is the document Dropbox - ProblemaTag.idml
    Thanks
    Ivan

    I haven't done a Book in CS6 yet, but I'm starting to wonder if there might be some sort of bug (not extremely likely, but....) that's new. We had another post yesterday where ID crashed when trying to move a particular file into the chapter 5 position.
    Can you add this file first, then move it to the correct spot after the other files are added?

  • Report for editing the word document with xml tags

    Hi all,
    My requirement is to edit the contents of the word document in the presentation server through report programming and save that document  in the presentation server.
    For eg if my word document contains many xml  tags with spaces < EDI_DS40 >, i would like to remove the spaces and i want it to be lyk <EDI_DS40>.Then say if i wanted to make some modification (addition, deletion,replacing with some text) in the text in some nth line of the document how can dis be dione.
    Is there any function module or bapi which serves this purpose.
    Can anyone pls guide me on dis.
    Thanks & Regards,
    Revathi.

    Hi,
    just to let you know I have sorted this.
    http://macintoshhowto.com/leopard/how-to-merge-pdf-files-with-preview-in-leopard .html
    Thanks.

  • Add XML Tag to XML File (Idoc to XML File)

    Hi there.
    Just a question regarding the addition of a tag header in an XML file please?
    Idoc - > XI -> file (XML File)
    We have a need to add something like this below in bold to XML Tag Header in the inbound file:
    <?xml version="1.0" encoding="UTF-8"?>
    <?POSTEN SND="SE03220037090" SNDKVAL="1" REC="SE03220669500"
    MSGTYPE="ORDERS"?>
    Any ideas on how this can be managed would be apreciated please?
    Thank you.
    Mick.

    Hi Carlos.
    Thanks for your reply. I like what you are suggesting, however, I have no knowledge of Java and how to implement this Java addition to the mapping interface.
    I would appreciate any hints you may have. The value that I am trying to add to the tag header is exactly as it is below(the value in bold) and it can in fact be fixed, i.e. I am not looking to dynamically determine the values in the additional tag but just add the value as it is below...
    <?xml version="1.0" encoding="UTF-8"?>
    <?POSTEN SND="SE03220037090" SNDKVAL="1" REC="SE03220669500"
    MSGTYPE="ORDERS"?>
    I would appreciate any input from you on that.
    Thanks in advance Carlos.
    Mick.

  • Script to map xml tags to para styles

    I am using the 'FindChangeByList.jsx' to format a series of text files.
    I realise that I can map tags to styles using the 'Tags" palette.
    But I wondered, if it is possible, if someone would be able to show me the syntax to include in my list (.txt file) to map xml tags to paragraph styles assigned in the list as it runs the script?
    Steve

    If you want through find and change here below is a function for apply tag on paragraph style
    var myDoc = app.activeDocument;
    addtags("A Head", "Head");
    addtags("Text", "P");
    function addtags(stylename, tag)
    if(myDoc.paragraphStyles.item(stylename) != null)
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    app.findGrepPreferences.findWhat = '.+';
    app.findGrepPreferences.appliedParagraphStyle = stylename;
    app.changeGrepPreferences.markupTag = tag;
    myDoc.changeGrep();
    app.findGrepPreferences = NothingEnum.nothing;
    app.changeGrepPreferences = NothingEnum.nothing;
    Shonky

  • How do I add Meta tags to pages?

    Is it possible to add meta tag information for the pages (such as keywords, description, robots, etc.) directly in Muse?
    I'd like to add meta tag data to describe the page to help with search engine optimization.

    I found a lot of useful information on here: http://www.muse-themes.com/blogs/news/6103624-seo-in-adobe-muse-search-engine-optimization #comments
    However I would like to know: If you have multiple pages dealing with different topics does one need to adjust the meta-data accordingly for each page.
    For example, I am redoing a website for a small earthmoving contractor who offers a range of services including new lawn installation (NOT mowing!), drainage, landscaping, post hole boring, driveways - to name a few; these are essentially the main pages with content explaining each service a little further.
    So would I be correct in assuming I should have a unique description, keywords and (obviously) page title for each page?
    How about the home page? Should the metadata attempt to cover all services offered within the website as a whole, or just the content of the home page?
    Thanks in advance!

  • How to create margins to ALL pages automatically?

    Hi guys. I need a help, then I will be ablo to do my work without any troubles.
    So, I need to understand 2 things. I hope you will easly help me.
    So...
    1) I wonder how can I change a margins in my document after I set my settings in frist time.
    I made a new document and I set some value on margins. Now I want to change this setting in a WHOLE document. But I don't know how to change in ALL document. I try to do this, and I go to section like this:
    And I set my new settings. But... It only happens in selected pages (not on ALL documents). And look what happen:
    So I don't know how to set this new settings to ALL PAGES.
    And there is another question. How can I make for example, different margin settings  1-21 page, then different margin settins 22-40 pages?

    Doc Maik wrote:
    Actually, the global document settings also contain margins. Changing these should apply to all pages, too.
    Which settings do you mean? Document setup can only access margins and columns during the intial setup, and those are what are used on the master page that is created. From that point on, margins are only accessible from the Layout menu, and settings there affect only the page(s) you currently have selected.

  • How put "meta" tag in page automatically

    This is standart html head of Oracle 9i report page:
    <html>
    <head>
    <base href="http://mysite...............etc...........9625.htm">
    </head>
    How compel to put this tag in page " <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> "
    Correct page:
    <html>
    <head>
    <base href="http://mysite...............etc...........9625.htm">
    " <meta http-equiv="Content-Type" content="text/html; charset=windows-1251"> "
    </head>
    Sorry for my English :)

    Hi,
    You could achieve that by changing the "Before report value" property of the report.
    F4 after select of report name in Object Navigator.
    ,Gicu

  • Add XML tag to the XML output File

    Experts,
    My Scenario is JDBC to File
    For the resultant xml file i have to append a line <?Test Line?> after
    <?xml version="1.0" encoding="UTF-8" ?> while passing it to legacy system ?
    From SDN I found that a XSLT Mapping(as second mapping in the Interface mapping) will do the above requirement,
    I got some XSLT Code from SDN to do this
    1) 
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" />
      <xsl:template match="/">
    <!--  add processing instruction -->
      <xsl:processing-instruction
    name="POSTEN">SND="SE03220037090" SNDKVAL="1" REC="SE03220669500" MSGTYPE="ORDERS"</xsl:processing-instruction>
    <!--  copy payload -->
      <xsl:copy-of select="." />
      </xsl:template>
      </xsl:stylesheet>
    2) 
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" />
      <xsl:template match="/">
    <!--  add processing instruction -->
      <xsl:processing-instruction
    name="POSTEN">SND="SE03220037090" SNDKVAL="1" REC="SE03220669500" MSGTYPE="ORDERS"</xsl:processing-instruction>
    <!--  copy payload -->
      <xsl:copy-of select="." />
      </xsl:template>
      </xsl:stylesheet>
    But none of them worked for me, the additional tag does not appear on the o/p xml file
    Any help would be appreciated
    Srinivas

    Hello Srinivas,
    I had achieved the same using java mapping:
    Suppose your XML structure is:
    <?xml version="1.0" encoding="UTF-8" ?>
    <Root Element>----
    </Root Element>
    you can use the following code:
              import java.io.*;
              import java.util.*;
              import com.sap.aii.mapping.api.*;
              public class AddCommentInXML implements StreamTransformation {
              String record=null;
              String comment=null;
              public void execute(InputStream in, OutputStream out) {
              try {
              DataInputStream stdin = new DataInputStream(in);
              int length = getLengthFromStream(stdin);
              stdin.reset();
              byte[] buffer = getBytesFromStream(stdin);
              String str = new String(buffer);
              record = "<Root Element>";
              comment ="<!Test Line><Root Element>";
              str = str.replaceAll(record,comment);
              out.write(str.getBytes());
              out.close();
              } catch (IOException e) {
              public int getLengthFromStream(InputStream is ) throws
              IOException{
              int i = 0;
              int length = 0;
              try{
              while ((i = is.read())> 0){
              length ++;
              }catch (ArrayIndexOutOfBoundsException e) {
              e.printStackTrace();
              return length;
              public byte[] getBytesFromStream(InputStream is) throws
              IOException {
    //             Create the byte array to hold the data
              byte[] bytes = new byte[getLengthFromStream(is)];
              is.reset();
    //             Read in the bytes
              int offset = 0;
              int tmp = 0;
              while (offset < bytes.length
              && (is.read(bytes, offset, offset +
              (tmp = is.available()))) > 0) {
              offset += tmp;
    //             Ensure all the bytes have been read in
              if (offset < bytes.length) {
              throw new IOException("Could not completely read Inputstream");
    //             Close the input stream and return bytes
              is.close();
              return bytes;
              public void setParameter(Map param) {
    Hope this helps.
    Regards,
    Shweta

  • Action Script to add MC as sub-pages ??

    Alright please help.. I have tried everything, been fooling
    around with this in the past 5 hours and its not going anywhere :(
    . Here is what i have. :
    I have 6 menu buttons... Button 4 is what i am concentrating
    on.
    at the moment here is the current action script of button 4 :
    --CODE---
    //-----this first few lines just controls the button
    animation --
    on (rollOver) {
    if (_root.link<>4) {
    gotoAndPlay("s1");
    on (releaseOutside, rollOut) {
    if (_root.link<>4) {
    gotoAndPlay("s2");
    //-----end of button animation-----
    on (release) {
    _root.scroller.scroller.gotoAndStop(3); // I understand this
    calls for fram 3 in an mc within an mc.
    if (_root.anim==true) { // not really sure where this means
    if (_root.link<>4) { // if value of _root.link
    <> 4 then activate the following code
    _parent["but"+_root.link].gotoAndPlay("s2"); // I kind of
    understand this part, i know it has to do with playing the button
    animation, but i am stuck where it says "but" + _root.link .
    _root.link = 4; // value of root.link
    _root.all.play();
    ok so basically, from what i can figure out what this action
    script does is : somehow it calls out a mc called "all action page"
    and the contents inside this mc are two layers. one layer is just a
    stop frame, and the other layer has multiple frames, each frame in
    the layer are each different mc's .. the _root.value is the value
    of each frame, for example if i change the value to 2 or 3 it will
    load frame 2 or 3 within the "all action page" mc..
    now my question, is is there any way i can replicate this
    script for the use of button 4 ?? i know i can just keep adding new
    frams and mc's to the current "all action page" and just keep
    changing the value that corresponds to the frame number, but i
    would like to make it more neater and structured incase if i need
    to change anything. any suggestions ??
    -Steph'

    This package contains two scripts the use EXIF meta data. The one you want is StampExif the other GoogleMapGPS....
    Crafting Actions Package UPDATED Aug 10, 2014 Added Conditional Action steps to Action Palette Tips.
    Contains
    Action Actions Palette Tips.txt
    Action Creation Guidelines.txt
    Action Dealing with Image Size.txt
    Action Enhanced via Scripted Photoshop Functions.txt
    CraftedActions.atn Sample Action set includes an example Watermarking action
    Sample Actions.txt Photoshop CraftedActions set saved as a text file.
    More then a dozen Scripts for use in actions
    Download

Maybe you are looking for