I have an applet which I need to be useable in all versions of macOS from 10.10 onwards. In the applet I have this code for getting the screen’s dimensions:
set mainScreenFrame to current application's NSScreen's mainScreen()'s frame() as list
set screen_width to item 1 of item 2 of mainScreenFrame as integer
set screen_height to item 2 of item 2 of mainScreenFrame as integer
In macOS 10.13 and above, the mainScreenFrame variable has contents that look like this:
But, in OS X 10.11, mainScreenFrame contains this:
Which naturally causes an error in the next line of code which tries to get screen_width.
It seems that different data is returned by NSScreen’s mainScreen()'s frame() in different versions of macOS. I can’t find any documentation on this. I’ve Googled and searched Apple’s documentation but can’t find anything on this.
Does anyone know where to find such documentation ?
Thanks.
Model: iMac (Retina 5K, 27-inch, Late 2015)
Browser: Safari 15.3 (17612.4.9.1.8)
Operating System: macOS 12