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

Script request: Adding display quality settings to existing script

Participant ,
Apr 19, 2023 Apr 19, 2023

I have the script below which toggles between Preview and Normal screen modes. I'm hoping someone would be able to edit/add to it so that when it's in Normal screen mode, it sets the Display Performance to Typcial Display and when it's in Preview screen mode it sets the Display performance to High Quality Display. Tried chatGPT but it wasn't helpful so any help would be greatly appreciated, thanks.

 

var nextMode = {

'PREVIEW_OFF' : ScreenModeOptions.PREVIEW_TO_PAGE,

'PREVIEW_TO_PAGE': ScreenModeOptions.PREVIEW_OFF

}


app.documents[0].layoutWindows[0].screenMode = nextMode[String(app.documents[0].layoutWindows[0].screenMode)];

 

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

correct answers 2 Correct answers

Community Expert , Apr 19, 2023 Apr 19, 2023

Hi @danielw42205661, I'd go with something like this:

 

 

var lw = app.documents[0].layoutWindows[0];

if (lw.screenMode !== ScreenModeOptions.PREVIEW_TO_PAGE) {
    // switch to high quality preview
    lw.screenMode = ScreenModeOptions.PREVIEW_TO_PAGE;
    lw.viewDisplaySetting = ViewDisplaySettings.HIGH_QUALITY;
    app.displayPerformancePreferences.ignoreLocalSettings = true;
}

else {
    // switch to typical screen mode
    lw.screenMode = ScreenModeOptions.PREVIEW_OFF;
    lw.viewDisplayS
...
Translate
Community Expert , Apr 19, 2023 Apr 19, 2023

Great! By the way, I edited the code. It is functionally the same, I just didn't like the way I'd done it before. You can use either way 🙂

Translate
Community Expert ,
Apr 19, 2023 Apr 19, 2023

Hi @danielw42205661, I'd go with something like this:

 

 

var lw = app.documents[0].layoutWindows[0];

if (lw.screenMode !== ScreenModeOptions.PREVIEW_TO_PAGE) {
    // switch to high quality preview
    lw.screenMode = ScreenModeOptions.PREVIEW_TO_PAGE;
    lw.viewDisplaySetting = ViewDisplaySettings.HIGH_QUALITY;
    app.displayPerformancePreferences.ignoreLocalSettings = true;
}

else {
    // switch to typical screen mode
    lw.screenMode = ScreenModeOptions.PREVIEW_OFF;
    lw.viewDisplaySetting = ViewDisplaySettings.TYPICAL;
    app.displayPerformancePreferences.ignoreLocalSettings = false;
}

 

 - Mark

 

Edit 2023-04-20: refactored for more sensible code.

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
Participant ,
Apr 19, 2023 Apr 19, 2023

@m1bThanks so much, really apprecitate it. Works exactly how I wanted it.

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 ,
Apr 19, 2023 Apr 19, 2023

Great! By the way, I edited the code. It is functionally the same, I just didn't like the way I'd done it before. You can use either way 🙂

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
Participant ,
Apr 19, 2023 Apr 19, 2023
LATEST

Absolute legend.

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