You are not logged in.
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:
Applescript:
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:
0.0, 0.0, 2560.0, 1440.0
But, in OS X 10.11, mainScreenFrame contains this:
x:0.0, y:0.0, width:2560.0, height:1415.0
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
Public servants are people too
Mac Studio M1 Max 24c, 32GB, 1TB; Studio Display; macOS Monterey, 12.3.1
Offline
It changed in High Sierra. You can read about workarounds here:
https://latenightsw.com/high-sierra-app … objc-bugs/
Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com
Online
It changed in High Sierra. You can read about workarounds here:
https://latenightsw.com/high-sierra-app … objc-bugs/
Many thanks. No wonder I couldn't find mention in Apple's documentation. Before looking at the suggestion, my code was designed for 10.13+. So, I decided to work around by adding code specifically for 10.11 and 10.12. It works but not as compact.
Cheers.
Public servants are people too
Mac Studio M1 Max 24c, 32GB, 1TB; Studio Display; macOS Monterey, 12.3.1
Offline