Friday, May 27, 2022

#1 2022-05-09 11:01:01 am

seanmurp
Member
Registered: 2018-08-14
Posts: 9

Find display profile in use on Monterey

Hello,
I've been searching all morning for a method to find the color profile currently used by each connected display.  We've been using the below Image Events call but running this on OS Monterey is returning "missing value". 

Applescript:


tell application "Image Events"
   launch
   tell displays to set {cnt, dName, sProfiles} to {count it, name, display profile}
   tell its display "Display 1"
       set thisProfile to display profile
   end tell
end tell

Does anyone know of a different method to find this info in Monterey?  system_profiler doesn't seem to have anything either.

Offline

 

#2 2022-05-09 01:18:18 pm

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 2285

Re: Find display profile in use on Monterey

I am on Catalina, so I'm not sure following "chevron" script will solve your problem.

Applescript:


set theScript to ¬
   "tell «class capp» \"Image Events\"
tell displays to set {cnt, dName, sProfiles} to {«event corecnte» it, «property pnam», «property mPrf»}
set thisProfile to «property mPrf» of «class disp» \"Display 1\"
end tell"


tell application "Image Events" to set theProfile to run script theScript


Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 14.1
Ram: 4 GB

Offline

 

#3 2022-05-09 01:24:22 pm

seanmurp
Member
Registered: 2018-08-14
Posts: 9

Re: Find display profile in use on Monterey

Unfortunately that returns the same "missing value" result.  Thanks for trying though.

Offline

 

#4 2022-05-09 01:39:29 pm

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 2285

Re: Find display profile in use on Monterey

Try this:

Applescript:


set displayInfo to do shell script "system_profiler -xml SPDisplaysDataType"

set displayKey to "<key>_IODisplayEDID</key>"
set nameKey to "<key>_name</key>" & return & tab & tab & tab & tab & tab & tab & "<string>"

set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, displayKey}
set {displayItems, AppleScript's text item delimiters} to {text items of displayInfo, tempTID}

set displayProfileNames to {}
repeat with anItem in rest of displayItems
   set here to (offset of nameKey in anItem) + (length of nameKey)
   set there to (offset of "</string>" in (text here thru -1 of anItem)) - 1
   set end of displayProfileNames to text here thru (here + there - 1) of anItem
end repeat

Last edited by KniazidisR (2022-05-09 01:43:53 pm)


Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 14.1
Ram: 4 GB

Offline

 

#5 2022-05-09 01:57:25 pm

seanmurp
Member
Registered: 2018-08-14
Posts: 9

Re: Find display profile in use on Monterey

I found something similar but that is only finding the display's name not actually the color profile being used by that display.  I'm in need of the color profile instead of the display's name.

Offline

 

#6 2022-05-09 02:02:54 pm

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 2285

Re: Find display profile in use on Monterey

You can use NSScreen class of Objective C as well to obtain all info for main screen. Here, I obtain for example  2  properties of main screen: display name & name of color space (that is, display profile):

Applescript:


use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "AppKit"
use scripting additions

tell (current application's NSScreen's mainScreen())
   set displayName to localizedName() as text
   set colorSpace to (localizedName() of colorSpace()) as text
end tell

return {Display_Name:displayName, Color_Space:colorSpace}

Last edited by KniazidisR (2022-05-09 09:34:53 pm)


Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 14.1
Ram: 4 GB

Offline

 

#7 2022-05-09 02:17:15 pm

seanmurp
Member
Registered: 2018-08-14
Posts: 9

Re: Find display profile in use on Monterey

Ooh, that works!  Exactly what I'm looking for!  Thanks so much.

Next question, is there a way to look at all screens versus just the main screen?  I had seen this command to get all NSScreen screens:

Applescript:


set theScreens to current application's NSScreen's screens

but don't know how to use each of those in a script like you just posted for main screen.

Offline

 

#8 2022-05-09 06:22:27 pm

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 1327

Re: Find display profile in use on Monterey

KniazidisR. Doesn't NSScreen require the AppKit framework?


2018 Mac mini - macOS Monterey - Script Debugger 8

Offline

 

#9 2022-05-09 09:34:19 pm

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 2285

Re: Find display profile in use on Monterey

peavine wrote:

KniazidisR. Doesn't NSScreen require the AppKit framework?


Yes, I will update the script above.

Last edited by KniazidisR (2022-05-09 09:45:43 pm)


Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 14.1
Ram: 4 GB

Offline

 

#10 2022-05-09 09:36:08 pm

KniazidisR
Member
From:: Greece
Registered: 2019-03-03
Posts: 2285

Re: Find display profile in use on Monterey

seanmurp wrote:

Next question, is there a way to look at all screens versus just the main screen?  I had seen this command to get all NSScreen screens:

Applescript:


set theScreens to current application's NSScreen's screens

but don't know how to use each of those in a script like you just posted for main screen.


You can use repeat loop:

Applescript:


use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "AppKit"
use scripting additions

set theScreens to current application's NSScreen's screens()

set DisplaysInfoList to {}
repeat with nextScreen in theScreens
   tell nextScreen
       set displayName to localizedName() as text
       set colorSpace to (localizedName() of colorSpace()) as text
   end tell
   set end of DisplaysInfoList to {Display_Name:displayName, Color_Space:colorSpace}
end repeat

return DisplaysInfoList

Last edited by KniazidisR (2022-05-09 09:40:25 pm)


Model: MacBook Pro
OS X: Catalina 10.15.7
Web Browser: Safari 14.1
Ram: 4 GB

Offline

 

#11 2022-05-10 08:10:33 am

seanmurp
Member
Registered: 2018-08-14
Posts: 9

Re: Find display profile in use on Monterey

Thanks so much

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)