簡體   English   中英

如何使用 Applescript(或命令行)加載顯示器顏色配置文件?

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

有沒有辦法使用 Applescript 或至少使用命令行檢索加載的顯示器顏色配置文件,因為我可以在 Applescript 中使用命令行? 我說的是所有插入顯示器的加載顏色配置文件,在“系統偏好設置 -> 顯示 -> 顏色”中定義的那些

編輯:我想獲取 ICC 配置文件的名稱,即每個連接的屏幕在“系統偏好設置”-> 顯示 -> 顏色中選擇的內容。

嘗試以下任一方法:

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(顏色管理)的方式是,雖然許多設備(包括紙張)的許多配置文件保存在適當的文件夾中,但只有一個可以用作系統配置文件。 對於監視器配置文件,只有在需要或需要系統配置文件時才“設置”。 如果創建了新的顯示器配置文件(通過校准),則該系統配置文件將被替換。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM