1 Reply Latest reply on Nov 14, 2014 3:10 PM by Jump_Over

    Javascript Error code 55:  does not support

    Feminho Diniz

      i'm trying to run the following script:


      Eu estou tentando redoar o seguinte script



      var myDocument = app.documents.add();

      var myTextFrame = myDocument.pages.item(0).textFrames.add();

      myTextFrame.geometricBounds = ["6p", "6p", "24p", "24p"];

      myTextFrame.contents = "Hello Worlfgfgd!";


      //Improved Hello World!

      //Enter the name of a font on your system, if necessary.


          myFont = app.fonts.item("Arial");


      catch (myError){};

      var myDocument = app.documents.item(0);


          var myPage = pages.item(0);

          var myBounds = myGetBounds(myPage,myDocument);


      //Get a reference to the text frame.

              var myTextFrame = textFrames.item(0);

      //Change the size of the text frame.

              myTextFrame.geometricBounds = myBounds;

              var myParagraph = myTextFrame.paragraphs.item(0);

              myParagraph.appliedFont = myFont;

              myParagraph.justification = Justification.centerAlign;

              myParagraph.pointSize = 48;



      //myGetBounds is a function that returns the bounds

      //of the "live area" of a page.

      function myGetBounds(myDocument, myPage){

          var myPageWidth = myDocument.documentPreferences.pageWidth;

          var myPageHeight = myDocument.documentPreferences.pageHeight;

          if(myPage.side == PageSideOptions.leftHand){

              var myX2 = myPage.marginPreferences.left;

              var myX1 = myPage.marginPreferences.right;



              var myX1 = myPage.marginPreferences.left;

              var myX2 = myPage.marginPreferences.right;


          var myY1 = myPage.marginPreferences.top;

          var myX2 = myPageWidth - myX2;

          var myY2 = myPageHeight - myPage.marginPreferences.bottom;

          return [myY1, myX1, myY2, myX2];



      but it's always givve me this message error:

      Javascript error!

      Error code 55

      error string: Object does not support the property or method 'documentPreferences'

      Mechanism main

      File:C:\Users\ ...........Scripts\Scripts Panel\Teste.jsx\Source.jsx

      Line 30   

      Origin:       var myPageWidth = myDocument.documentPreferences.pageWidth;



      This javascript script was copy and paste exactly as it is. i founded this in ADOBE INDESIGN CS6 SCRIPTING TUTORIAL ¬¬




      eu achei esse codigo num pdf da adobe: Adobe Indesign Scripting Tutorial e ele sempre me dá o erro supracitado. Alguém?