Skip to main content
Geppetto Luis
Legend
November 4, 2018
Answered

Screen resolution

  • November 4, 2018
  • 2 replies
  • 1680 views

I work with different screen resolutions

I would like this if possible

if the screen resolution and 1920px or higher does one thing

If the resolution is less than 1920 px, it does something else.

This topic has been closed for replies.
Correct answer r-bin

if ($.screens[0].right == 1920)

    alert(1920)

else                 

    alert()

2 replies

r-binCorrect answer
Legend
November 5, 2018

if ($.screens[0].right == 1920)

    alert(1920)

else                 

    alert()

JJMack
Community Expert
Community Expert
November 4, 2018

1920 is not screen resolution its the number of pixels in the width and 1080 would me the number of pixel high. the are many different size 1920x1080 displays  each size has its ppi resolution they are all not the same resolution the all display 1920x1080 pixels.  You can have more than one display and the do not need to display the same number of pixels or have the same resolution. A window can span across displays for example  your desktop background wall paper.

Here I have 3 displays two are 1600x1200 100ppi resolution and one is a 3840x2160 with a 185ppi resolution. My wall Paper has three sections and the section are for a single image scaled to two different resolution in three sections,  Look at the screen capture.

JJMack
Known Participant
November 4, 2018

JJMaak

I need to know the resolution of the screen in use

I do not have to use 3 screens

if I use a screen with a resolution lower than 1920px long side

It leaves notice that it is less than 1920px

if I use a screen with a resolution higher than 1920px long side

exits notice that is above 1920px

JJMack
Community Expert
Community Expert
November 6, 2018

JJMack you're right

it is not easy to do this with scripts for the problem you described

thank you


You are wrong there it is actually easy.  You just need to figure the width and height relatively.

#target photoshop

msg="";

for (var i=0;i<$.screens.length;i++) {

msg = msg + "Display " + (i+1) + "\nTop " + $.screens.top  +  " Left " + $.screens.left

+ "\nBottom " + $.screens.bottom + " Right " + $.screens.right

+ "\nWidth "  + ( $.screens.right - $.screens.left)   + " Height "+ ( $.screens.bottom - $.screens.top)

+ "\n\n";

}

alert(msg);

JJMack