[编辑:我很抱歉为您的ExtendScript问题提供AppleScript答案。我只是看着AS的问题,忘了我去了一个不同的部分。我只能希望你在Mac上。如果不是这样,我想我就吃掉我的downvotes哭泣。]
有一种变通方法。它的优点(以及它的部分解决方法)是它可以在所有应用程序中运行。缺点是,它需要Python(这应该是你的Mac上无论如何 - 很容易安装,如果没有),以及第三方软件(包括免费)两片,“checkModifierKeys”和“cliclick”。我一直在使用脚本,出现在我的脚本菜单多年。 蟒蛇部分说明如下:http://thechrisgreen.blogspot.com/2013/04/python-script-for-getting-pixel-color.html 该脚本可以保存,做出可执行文件和使用AS do shell script
命令调用。 及其余部分,用于在屏幕上选择一个点并等待控制键被按下(这就是我的工作方式)非常简单。 基本checkModifierKeys部分(其等待,直到控制键被按下)是:
set controlIsDown to false
repeat until (controlIsDown)
set initialCheck to ((do shell script "/usr/local/bin/checkModifierKeys control"))
if initialCheck = "1" then set controlIsDown to true
end repeat
的cliclick部分(其获得的坐标)是:
set xyGrabbed to do shell script "/usr/local/bin/cliclick p"
这似乎是一个很长的路要走去做,但它的效果很好。我的版本使用此处理程序将rgb值转换为十六进制,这对我的目的很有用:
to makeHex(theNumber) --was anInteger
--Converts an unsigned integer to a two-digit hexadecimal value
set theResult to ""
repeat with theIndex from 1 to 0 by -1
set theBase to (16^theIndex) as integer
if theNumber is greater than or equal to theBase then
set theMultiplier to ((theNumber - (theNumber mod theBase))/theBase) as integer
set theResult to theResult & item theMultiplier of ¬
{1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F"}
set theNumber to (theNumber - theBase * theMultiplier)
else
set theResult to (theResult & "0")
end if
end repeat
theResult
end makeHex
不需要道歉:其他人可能有相同的问题,而*在Mac上工作。 – usr2564301
感谢您的解决方案!我爱苹果,永远不会得到一种不同的电脑:) – bearacuda13
那么,这有点“平台主义”,但我原谅你:-)我很高兴你觉得这有帮助! – CRGreen