【问题标题】:Mac Automator to check screen colorsMac Automator 检查屏幕颜色
【发布时间】:2018-09-04 02:43:02
【问题描述】:

Mac Automator 有没有办法检查某个像素的屏幕颜色?

我已经用谷歌搜索过这个问题,我唯一发现的是使用 applescript 进行屏幕截图。 (这还不够,因为它会在每次执行时为我保存一张照片。:|

谢谢。

【问题讨论】:

    标签: automator


    【解决方案1】:

    此解决方案可能适合您。使用 (FREE) AppleScript Toolbox scripting addition 中的术语来设置您的鼠标位置并单击该指定坐标...您可以将我刚刚编写的以下代码保存在 AppleScript 编辑器中作为应用程序。

    set xyCoordinates to {}
    
    activate
    set temp to words of text returned of (display dialog ¬
        "Please Enter Your X And Y Coordinates" default answer ¬
        "250, 250" buttons {"Cancel", "OK"} ¬
        default button 2 ¬
        cancel button 1 ¬
        with title "Get RGB Color Value") as list
    
    repeat with i from 1 to count of temp
        set thisItem to item i of temp
        set end of xyCoordinates to thisItem as integer
    end repeat
    
    set theIcon to path to resource "AppIcons.icns" in bundle application "Digital Color Meter"
    
    activate application "Digital Color Meter"
    delay 1
    AST set mouse point location xyCoordinates
    tell application "System Events" to tell process "Digital Color Meter"
        set resultUIElementList to click at xyCoordinates
        delay 1
        keystroke "C" using {shift down, command down}
    end tell
    delay 1
    set colorValue to words of (the clipboard) as list
    delay 1
    
    activate
    display dialog ("Your RGB Values Are " & return & (item 1 of colorValue) & " " & (item 2 of colorValue) & " " & (item 3 of colorValue)) ¬
        buttons {"OK"} default button "OK" with icon theIcon giving up after 5
    quit application "Digital Color Meter"
    

    【讨论】:

    • 预期的行尾等,但发现此行的“设置”:AST set mouse point location xyCoordinates
    • 啊,好吧,我没看过你的cmets!非常感谢它的出色工作!
    猜你喜欢
    • 2012-01-28
    • 2011-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-15
    • 2023-03-25
    • 1970-01-01
    • 2011-03-03
    相关资源
    最近更新 更多