首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用Applescript (或命令行)获得加载的监视器颜色配置文件?

如何使用Applescript (或命令行)获得加载的监视器颜色配置文件?
EN

Stack Overflow用户
提问于 2020-02-22 09:36:29
回答 3查看 424关注 0票数 1

是否有一种方法可以使用Applescript或至少使用命令行恢复加载的监视器颜色配置文件,因为我可以在Applescript中使用命令行?我指的是所有插入显示器的加载颜色配置文件,即“系统首选项->显示->颜色”中定义的颜色配置文件。

编辑:我想获得ICC配置文件的名称,即在“系统首选项”中为每个连接的屏幕选择“->显示->颜色”中选择的内容。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2020-02-23 20:15:45

尝试以下两种方法之一:

代码语言:javascript
运行
复制
tell application "Image Events" to display profile of displays as list
tell application "Image Events" to display profile of display 1

您可以在Image下的Image字典中获得更多(但不多)的详细信息。

显示0和显示1似乎都会产生相同的结果(内置显示)。display 2将指外部显示。我有一个非常简单的装置,所以取决于你的,你可能要做实验。

票数 3
EN

Stack Overflow用户

发布于 2020-02-23 21:12:58

如果您想要将显示名称与其颜色配置文件匹配,获取显示名称是前Catalina系统中的主要问题,但是可以对system_profiler实用程序的结果进行按摩,以获得早期系统中的名称。一个小小的AppleScriptObjC就能得到剩下的:

代码语言:javascript
运行
复制
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文档讨论了列表中的主屏幕。

票数 0
EN

Stack Overflow用户

发布于 2021-05-04 07:49:35

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

我理解windows (颜色管理)的方法是,虽然许多设备(包括纸张)的配置文件都保存在适当的文件夹中,但只有一个可以用作系统配置文件。对于监视器配置文件,只有在需要或需要系统配置文件时“设置”的配置文件。如果创建了一个新的监视器配置文件(通过校准),那么该系统配置文件将被替换。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60350804

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档