• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Setting Baseline Preferences

New Here ,
Jul 02, 2008 Jul 02, 2008

Copy link to clipboard

Copied

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
TOPICS
Scripting

Views

472

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jul 02, 2008 Jul 02, 2008

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

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'
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2008 Jul 07, 2008

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 11, 2008 Jul 11, 2008

Copy link to clipboard

Copied

LATEST
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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines