如何使用 Applescript(或命令行)加载显示器颜色配置文件?

How to get loaded monitor color profile with Applescript (or command line)?

有没有办法使用 Applescript 或至少使用命令行来检索加载的显示器颜色配置文件,因为我可以在 Applescript 中使用命令行? 我说的是所有已插入显示器的加载颜色配置文件,这些显示器在 "System Preferences -> displays -> color"

中定义

EDIT:我想获取 ICC 配置文件的名称,即在 "System Preferences" -> 显示 -> 颜色中为每个连接选择的名称屏幕.

尝试以下任一方法:

tell application "Image Events" to display profile of displays as list
tell application "Image Events" to display profile of display 1

您可以在 Image Suite 下的 Image Events 词典中获取更多(但不是很多)详细信息。

显示器 0 和显示器 1 似乎都产生相同的结果(内置显示器)。显示器 2 指的是外部显示器。我有一个非常简单的设置,所以根据您的设置,您可能需要进行试验。

获取显示名称是 Catalina 之前系统中的主要问题,如果您想将显示名称与其颜色配置文件相匹配,但是可以修改 system_profiler 实用程序的结果以获取名称较早的系统。一点 AppleScriptObjC 就会得到其余的:

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

on run -- example
    set screenProfiles to ""
    set theScreens to current application's NSScreen's screens
    set displayNames to getDisplayNames(theScreens) -- handle older systems
    repeat with i from 1 to (count theScreens)
        set profile to localizedName of colorSpace of item i of theScreens
        set displayName to item i of displayNames
        set screenProfiles to screenProfiles & "Name:   " & displayName & return & "Profile:    " & profile & return & return
    end repeat
    display dialog screenProfiles with title "Screen Color Profiles"
end run

to getDisplayNames(screenList)
    set theNames to {}
    if (get system attribute "sys2") > 14 then -- 10.15 Catalina and later
        repeat with screen in screenList
            set end of theNames to localizedName of screen
        end repeat
    else -- munge system profiler data
        set displayKey to "<key>_IODisplayEDID</key>"
        set nameKey to "<key>_name</key>" & return & tab & tab & tab & tab & tab & tab & "<string>"
        set displayInfo to do shell script "system_profiler -xml SPDisplaysDataType"
        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}
        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 theNames to text here thru (here + there - 1) of anItem
        end repeat
    end if
    return theNames
end getDisplayNames

NSScreen 文档对列表中的主屏幕进行了讨论。

我在这里不建议或提出任何技术建议,因为我没有资格这样做,并且对你们所做的工作印象深刻。

我对 windows CM(色彩管理)的理解是,虽然许多设备(包括纸张)的许多配置文件都保存在相应的文件夹中,但只有一个可以用作系统配置文件。对于监视器配置文件,只有 'set' 需要或需要系统配置文件。如果创建了新的显示器配置文件(通过校准),则该系统配置文件将被替换。