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”.


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.

I am on Catalina, so I’m not sure following “chevron” script will solve your problem.


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

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

Try this:


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

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.

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):


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}

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:


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.

KniazidisR. Doesn’t NSScreen require the AppKit framework?

Yes, I will update the script above.

You can use repeat loop:


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

Thanks so much