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

InDesign scripts won't apply multiple pasteboardPreferences changes

Participant ,
Dec 05, 2022 Dec 05, 2022

I have a simple two-line script:

app.activeDocument.pasteboardPreferences.pasteboardMargins = ['200 mm',0];
app.activeDocument.pasteboardPreferences.matchPreviewBackgroundToThemeColor = 1;

When I run it, only the last preference change is actually applied (in this case, changing the preview background). If I switch the order of lines, only the margins get changed. Why does this happen, and what is the best practice for avoiding it?

Using Adobe InDesign 18.0 on Windows 10.

TOPICS
Scripting
591
Translate
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
Community Expert ,
Dec 05, 2022 Dec 05, 2022

Hi @gdwd I'm running Indesign 18.0 on MacOS 13, and I can confirm the same behaviour.

 

In my quick testing it seems that: setting matchPreviewBackgroundToThemeColor to 1 sets the pasteboardMargins to [0,0]. I have lodge a bug. Please vote to have it fixed.

- Mark

Translate
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
People's Champ ,
Dec 06, 2022 Dec 06, 2022

Same here, even with using "properties" property and passing the whole set at once or using a true Boolean value instead of 1.

 

Translate
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
Community Expert ,
Dec 06, 2022 Dec 06, 2022

Thanks Loic, yes I tried using properties, too. Also tried wrapping it in a doScript call. Tried in Applescript and the matchPreviewBackgroundToThemeColor couldn't seem to be set at all.

Translate
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
Community Expert ,
Jan 17, 2023 Jan 17, 2023

Hi @gdwd ,

seems that this statement alone, set to true or false, it does not matter:

app.activeDocument.pasteboardPreferences.matchPreviewBackgroundToThemeColor = true;

sets the pasteboardMargins to [0,0]. Tested with my German InDesign 2023 version 18.1 on Windows 10.

 

Voted for fixing the bug!

 

Regards,
Uwe Laubender
( Adobe Community Expert )

 

Translate
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
Community Expert ,
Jan 17, 2023 Jan 17, 2023
LATEST

To work around the issue with matchPreviewBackgroundToThemeColor one could use the corresponding menuAction.

app.menuActions.itemByName("$ID/Match Pasteboard to Theme Color").invoke();

But it's impossible to know in which direction the change is going. This menu action could turn it on or off.

 

The second line will always return false; even if you run the script two times:

app.menuActions.itemByName("$ID/Match Pasteboard to Theme Color").invoke();
app.activeDocument.pasteboardPreferences.matchPreviewBackgroundToThemeColor;

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Translate
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