Skip to main content
michaelg15618274
Inspiring
December 29, 2015
Question

how do i record the eye droper in an action

  • December 29, 2015
  • 2 replies
  • 231 views

I'm trying to figure out a way to record the eye dropper in an action. I would like to sample the top middle portion of the image, do some other actiony stuff and then eye drop the bottom portion. I can't get it to work. It was suggested to me to write a script to make this magic happen but i have no idea about scripting. How in the dang-diddly-darn do i write a script that does that? Any help would be much appreciated!

This topic has been closed for replies.

2 replies

c.pfaffenbichler
Community Expert
Community Expert
December 29, 2015
do some other actiony stuff

What in particular?

And of what significance are the color values you want to measure for the procedure anyway?

c.pfaffenbichler
Community Expert
Community Expert
December 29, 2015

// 2015, use it at your own risk;

#target photoshop

if (app.documents.length > 0) {

var myDocument = app.activeDocument;

var theColor = eyedropperTool(500, 500);

if (theColor) {

alert (theColor.rgb.red+"_"+theColor.rgb.green+"_"+theColor.rgb.blue)

}

};

////// simulate eyedropper with color sampler //////

function eyedropperTool (theX, theY) {

// set units;

var originalRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

// set sampler;

try {

var theSampler = activeDocument.colorSamplers.add([theX, theY]);

var theColor = theSampler.color;

theSampler.remove();

} catch (e) {return};

// reset;

app.preferences.rulerUnits = originalRulerUnits;

return theColor

};