I have a situation where I need users to be able to pick colors from around their screen quickly.
I want them to use the Apple Color Picker’s eyedropper to get the colors, but I’m trying to avoid all the usual clicking involved. The script will be run from a key command.
What I have so far is this:
ignoring application responses delay 0.1 set frontApp to the name of the current application tell application "System Events" tell process frontApp click checkbox 1 of window "Colors" end tell end tell end ignoring choose color
This brings up the color picker and puts it into eyedropper mode. All that first part inside the “ignoring” is just to auto-click the “eyedropper” button after the color picker dialog comes up.
The user may take any amount of time to sample the exact color they want, so I can’t close the dialog on a delay. The moment they click to sample, I want to take them back out of the color picker box. As it works now, for some reason even a keystroke on [return] or [enter] won’t even get them out of the color picker, so they have to actually target the “OK” button with the mouse, which wastes half their time.
So I just want to idle the script until they click, then on click, I’ll do the following:
tell application "System Events" tell process frontApp click button "OK" of window "Colors" end tell end tell
to close the window, and I can use the color returned.
I’d also be fine with the script running on a down keystroke, they keep holding the key down until they click to sample, then release the key and it takes them out of the dialog, if that’s possible. I couldn’t figure that out either.
Thanks in advance for any help,