Mac Automator检查屏幕颜色

时间:2018-09-03 11:08:40

标签: automator

Mac Automator是否可以检查某个像素的屏幕颜色?

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

谢谢。

1 个答案:

答案 0 :(得分: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"

enter image description here

相关问题