8 Replies Latest reply on Feb 15, 2008 9:21 AM by (Avi)

    About preset

      Hello all

      I am creating a document preset using js

      var myDocumentPreset;
      myDocumentPreset = app.documentPresets.item("Amit");
      with(myDocumentPreset)
      {
      pageHeight = "30p0";
      pageWidth = "40p0";
      left = "1p0";
      right = "1p0";
      top = "3p4";
      bottom = "3p1";
      columnCount = 2;
      pagesPerDocument = 4;
      pageOrientation = PageOrientation.landscape;
      }

      But the problem is when i am trying to create a document still it will take the default preset it will not take the preset that i just created.

      In my point of view the problem is when you are creating a preset you are not save it. This might create a problem.

      So can anybody know how to save the document preset.

      Thank you,

      --Avi
        • 1. Re: About preset
          Peter Kahrel Adobe Community Professional & MVP
          The code you showed cannot work. First you need to create a preset as follows:

          if (app.documentPresets.item ("Amit") == null)
          {
          with(app.documentPresets.add())
          {
          name = "Amit";
          pageHeight = "30p0";
          // rest of the preset definitions
          }
          }

          Then, when you want to create a new document with those presets, you do this:

          app.documents.add ({DocumentPreset: "Amit"})

          Peter
          • 2. Re: About preset
            Level 1
            Hello Peter

            I am trying to used code what you had given yesterday.
            when i add this code it still take the default preset.
            I do not know why.

            --Avi
            • 3. Re: About preset
              Level 1
              What do you mean by "it still take the default preset"?

              What "it" are you talking about? Your script only appears to create a preset. It doesn't use it.

              Dave
              • 4. Re: About preset
                Level 1
                I am using it to other script

                var myDocument = app.documents.add();
                app.documents.add ({DocumentPreset: "Amit"})
                app.documents[0].transparencyPreferences.blendingSpace = BlendingSpace.RGB
                with(myDocument.documentPreferences)
                {
                pageWidth = "30p0";
                pageHeight = "40p0";
                pagesPerDocument = 4;
                }
                with(myDocument.masterSpreads.item(0).pages.item(0).marginPreferences)
                {
                columnCount = 2;
                columnGutter = "1p2";
                bottom = "3p1";
                left = "1p0";
                right = "1p0";
                top = "3p4";
                }
                myDocument.gridPreferences.properties =
                {
                baselineStart:"3p4",
                baselineDivision:"1p1",
                baselineShow:true,
                horizontalGridlineDivision:"6p0",
                horizontalGridSubdivision:"8p0",
                verticalGridlineDivision:"6p0",
                verticalGridSubdivision:"8p0",
                baselineColor:[224,161,117],
                documentGridShown:false,
                }

                var myDocument = app.activeDocument;
                with(myDocument.guidePreferences)
                {
                guidesInBack = true;
                documentGridSnapTo = true;
                guidesColumnLocked = true;
                }

                hear i am using predefine document preset.
                my problem is the text frame of master is same as default margin. i want the text frame should be same as document margin.

                I am doing write thing or i am on the wrong way.
                please help

                --Avi
                • 5. Re: About preset
                  Level 1
                  Look at the definition of the add() method for documents in the Object Model Viewer:

                  Documents.add (showingWindow:boolean, documentPreset: DocumentPreset , withProperties:Object): Document

                  Creates a new document.

                  showingWindow (optional): Data Type: boolean, Default Value: true
                  If true, displays the document. (Optional)

                  documentPreset: Data Type: DocumentPreset
                  The document preset to use. (Optional)

                  withProperties: Data Type: Object
                  Initial values for properties of the new Document (Optional)

                  You have a properties record where you should have a boolean to indicate whether or not you want a visible window.

                  Dave
                  • 6. Re: About preset
                    Level 1
                    I am trying to do same thing in different way.
                    First i created a preset. then using above script i am creating a document. when i am creating it the text frame of master is same as margin of default preset .

                    but , after creating a preset i go to documentpreset and save the preset with the same name. In this case every thing work fine.

                    There is a option in document preset to save the preset. If i save the preset i will get the master text frame as same as document margin.

                    Can you tell me how to save the preset.
                    • 7. Re: About preset
                      Level 1
                      Look under Application in the OMV. The exportPresets() method is what you want.

                      Dave
                      • 8. Re: About preset
                        Level 1
                        I am trying to use your script as you are said.
                        i use exportPresets() still i am getting default master frame.
                        In exportPresets we are exporing the preset we are not saveing it.
                        I need to save the preset which i am creating.