2 Replies Latest reply on Dec 29, 2015 9:00 AM by c.pfaffenbichler

    how do i record the eye droper in an action

    michaelg15618274

      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!

        • 1. Re: how do i record the eye droper in an action
          c.pfaffenbichler Level 9

          // 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

          };

          • 2. Re: how do i record the eye droper in an action
            c.pfaffenbichler Level 9
            do some other actiony stuff

            What in particular?

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