Skip to main content
danielw42205661
Known Participant
April 20, 2023
Answered

Script request: Adding display quality settings to existing script

  • April 20, 2023
  • 1 reply
  • 797 views

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)];

 

This topic has been closed for replies.
Correct answer m1b

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 🙂

1 reply

m1b
Community Expert
Community Expert
April 20, 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.

danielw42205661
Known Participant
April 20, 2023

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

danielw42205661
Known Participant
April 20, 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 🙂


Absolute legend.