3 Replies Latest reply on Feb 21, 2008 9:23 AM by (Olav_Kvern)

    Execute an action through scripting

      Hi

      I would like to select a text frame which is associated with the root element from the body page and click the Untag button from the tags palette. Is it possible to automate it through scripting.

      Thanks
        • 1. Re: Execute an action through scripting
          Level 1
          Hi Priya1,

          How about:

          app.documents.item(0).xmlElements.item(0).untag();

          Thanks,

          Ole
          • 2. Re: Execute an action through scripting
            Level 1
            Hi Ole

            i have tried the above one but it remove the complete structure the thing is my root element is associated with a text frame and i want to untag it.

            Manually i am able to do it by selecting the text frame and by clicking the Untag button from "Windows>Tags" palette. This when done deletes all the XML structure except the root element which is now not associated with any text frame but still exists.

            I would do these actions through scripting.

            Thanks
            • 3. Re: Execute an action through scripting
              Level 1
              Hi Priya,

              If the text frame is associated with the root, then you have other problems--really, the root should never be associated with a page item. Here's something that will untag the currently-selected frame:

              var myMenuAction = app.menuActions.item("Untag Frame");
              myMenuAction.invoke();

              Note, however, that invoking menu items is not a good way to work with scripting. This script will probably also fail in localized versions of InDesign--you'll have to mess with a translated key string (as described in the Scripting Guide) for it to work everywhere.

              Thanks,

              Ole