I'd like to be able to use an eyedropper tool on command. The built-in Mac colour picker is nice, so to that end, I set up a keyboard shortcut using BetterTouchTool to open the colour picker; it does so simply by running the choose color
AppleScript command.
This is only a partial solution, because I still need to click the eyedropper icon to get what I want. Apart from the minor nuisance of an extraneous click, the problem is that the click itself changes focus away from the application I'm using. (For example, suppose I'm using the eyedropper to test the :focus
state of an element on a website.)
Is there a way to tell my script to run the eyedropper tool after opening the colour picker? In other words, I would like to automatically click the button indicated in this screenshot:
Best Answer
Updated Answer
I download the trial of BetterTouchTool and resolved the issue in the following manner:
Note that this was done under macOS Big Sur and it works without issue after the initial setup and permissions setting as were prompted.
Now when I press ⇧⌃P the Color window opens and the color picker button is clicked, and it is active to select a color where the mouse pointer was when the keyboard shortcut was pressed.
Original Answer
I do not have BetterTouchTool, so using Script Editor I find that if one just runs the
choose color
command, the Colors window is modal and does not allow any additional code that would click the color picker button to run.To work around this, the
choose color
command can be wrapped within anignoring application responses
statement. However, while this allows the color picker button to be clicked by additional code, one does not get back, e.g.{14896, 20151, 65429}
from thechoose color
command when the OK button is cliched after picking the color.Example AppleScript code:
This was tested under macOS Catalina.