4 Replies Latest reply on Jul 11, 2008 2:19 PM by Warren Bingham

    Setting Baseline Preferences

    Warren Bingham Level 1
      I'm stuck. I need to reset the baseline grid for a specific document and I'd like to read the current preferences and then adjust them to one of two different preferences.

      I can create a script which reads and sets the preferences for a document, but it doesn't change what is displayed or what is stored in the InDesign Preferences, Grid location.

      Does anyone have an idea what I need to change. When I try to review the documentation, it says that the baselineFrameGridOption as a preference is read only, but for a document it is read/write. What do I do?

      TIA,

      Warren Bingham

      Here's my small little script. No if statements yet, I'm just trying to get it to switch the baseline grid.

      if (app.documents.length != 0){
      var myDoc = app.documents.item(0)
      }
      else{
      alert ("Please open a document and try again.");
      }

      var gridOptions = myDoc.baselineFrameGridOptions;
      gridOptions.useCustomBaselineFrameGrid= true
      gridOptions.baselineFrameGridIncrement = 10.25
      gridOptions.startingOffsetForBaselineFrameGrid = 59
        • 1. Re: Setting Baseline Preferences
          Level 1
          At the moment, all I can confirm is that I get the same results as you. The script seems to work if you interrogate the values in ESTK, but the values don't seem to be reflected in the UI.

          Dave
          • 2. Re: Setting Baseline Preferences
            Warren Bingham Level 1
            The only way I got it to work was to work with the gridPreferences for the document instead of the application. My final script just toggles between two different leading grids.

            Thanks,

            Warren Bingham

            The script:

            if (app.documents.length != 0){
            var myDoc = app.documents.item(0)
            }
            else{
            alert ("Please open a document and try again.");
            }

            var gridPrefs = myDoc.gridPreferences;
            var bStart = gridPrefs.baselineStart + ''
            var bStartSplit = bStart.split(".")
            var bStartPicas = bStartSplit[0]
            var bStartPoints = ("." + bStartSplit[1])*12
            var bStartMeasured = bStartPicas + "p" + bStartPoints

            if (bStartMeasured == '4p11')
            { myDoc.gridPreferences.baselineStart = '15p2.25'
            myDoc.gridPreferences.baselineDivision= '0p10.25'
            }
            else
            { myDoc.gridPreferences.baselineStart = '4p11'
            myDoc.gridPreferences.baselineDivision= '0p10.25'
            }
            • 3. Re: Setting Baseline Preferences
              Level 1
              Hi Warren,

              Grid preferences for the document is the right place to do what you want to do. When you set grid preferences for the application, it will affect all new documents, but leaves existing documents unchanged.

              This is exactly how preferences work in the user interface--make changes with no document open, and you're setting application preferences; make changes in a document with nothing selected, and you're setting document preferences.

              Thanks,

              Ole
              • 4. Re: Setting Baseline Preferences
                Warren Bingham Level 1
                So if I did not have a document open, then the changes would have taken effect of new documents created, but not on existing documents that were opened?

                Thanks,

                Warren