Photoshop CS color sampling help! please

I am trying to figure out way for photoshop to tell me if an image is all black or not. A friend of mine found a way to create a 16 x 16 pixel selection and sample the color and determine if it is black or not. The selection then moves across the image and then to the next row. It continues this motions and if it finds a part of the image that is not black it immediately throws and error and the location of the infraction.

The problem is he wrote the script in javascript and while it works great with CS3, some of the terms are not recognized by CS.

Does anyone have any idea how I can accomplish this task using either javascript or applescript for Photoshop CS. THANKS!

the script is below:

var defaultRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;

var black = new SolidColor; = 0 = 0 = 0

var height = 32;
var width = 32;

var horizontalBlocks = app.activeDocument.width/width;
var verticalBlocks = app.activeDocument.height/height;

var sampler = app.activeDocument.colorSamplers.add([0,0]);
var x1 = a%horizontalBlocks
var y1 = Math.floor(a/horizontalBlocks)*height;
var x2 = x1+width;
var y2 = y1+height;[[x1,y1],[x2,y1],[x2,y2],[x1,y2]]);
var colorRef = sampler.color;
alert(“difference found at [” + x1 + “,” + y1 + “]”)


preferences.rulerUnits = defaultRulerUnits;

I came up with a decent workaround that was under my nose the whole time

I can get the histogram value of the doc and then check the number of pixels for black and make sure they are all there.