11 Replies Latest reply on Nov 8, 2012 4:32 AM by qmuli2012

    documentPreferences from an imported XML




      I am trying to set my documentPreferences from an imported XML as below and I get  - "No data available of the requested type" for mytrimh, could you let me know what I am doing wrong please.



      function mySnippet(){


          //Opens an existing document. You'll have to fill in your own file path

          var myDocument = app.open(File("C:/OpenDocument.indd"));



          var myXMLViewPreferences = myDocument.xmlViewPreferences;

          myXMLViewPreferences.showAttributes = true;

               myXMLViewPreferences.showStructure = true;

               myXMLViewPreferences.showTaggedFrames = true;

               myXMLViewPreferences.showTagMarkers = true;

               myXMLViewPreferences.showTextSnippets = true;






      function myPrefs(){

          var myDoc = app.activeDocument

          var mytrimh = myDoc.xmlElements.item(0).xmlElements.item(0).xmlElements.item(-9);

          var mytrimw = myDoc.xmlElements.item(0).xmlElements.item(0).xmlElements.item(10);

          myDoc.documentPreferences.pageWidth = "mytrimh";

          myDoc.documentPreferences.pageWidth = "mytrimw";