Copy link to clipboard
Copied
Hi all,
I've used Image->Adjustments->Thresholds to sample the darkest and lightest points of an image with the eyedropper tool. This provides me with two, in this case, CMYK measurements in the Info pane. What I'm trying to establish are the AppleScript commands to retrieve these CMYK values from either the points being sampled or those registering in the Info pane. As pointed out to me by c.pfaffenbichler, the solution may be provided via Javascript. As I don't really know this language, I'd prefer an Applescript solution, but I'll work with Javascript if needs must.
I have searched the interweb and haven't returned any useful information, although I concede that I may I've used incorrect search terms. I've also looked through the Applescript dictionaries too.
I'd be really grateful for any assistance.
Ian Thompson
Choose layer you want to set Threshold for, then run script. It's going to create new (theshold) adjustment for that layer and make back your layer an active one. Then it stops that you can use 'Color Sampler Tool' on layer. When you do it, run script again, so it will check CMYK values for chosen positions to alert them at end.
if ((l0 = (aD = activeDocument).layers[0]).kind != LayerKind.THRESHOLD) {
function sTT(v) {return stringIDToTypeID(v)}
(ref1 = new ActionReference()).putClass(sTT('adj
...
Copy link to clipboard
Copied
Choose layer you want to set Threshold for, then run script. It's going to create new (theshold) adjustment for that layer and make back your layer an active one. Then it stops that you can use 'Color Sampler Tool' on layer. When you do it, run script again, so it will check CMYK values for chosen positions to alert them at end.
if ((l0 = (aD = activeDocument).layers[0]).kind != LayerKind.THRESHOLD) {
function sTT(v) {return stringIDToTypeID(v)}
(ref1 = new ActionReference()).putClass(sTT('adjustmentLayer'));
a = ["Reference(sTT('null'), ref1", "Integer(sTT('level'), 128",
"Object(sTT('type'), sTT('thresholdClassEvent'), dsc2"]
for(i = 0; i < a.length; i++) {
eval("(dsc" + (i + 1) + " = new ActionDescriptor()).put" + a[i] + ')')
}
dsc1.putObject(sTT('using'), sTT('adjustmentLayer'), dsc3)
executeAction(sTT('make'), dsc1, DialogModes.NO)
}
else if(str = '', l0.remove(), (cS = Array()
.slice.call(S = aD.colorSamplers)).length) {
for (c = [[], []], i = 0; i < cS.length; i++) {
for(j in cS[0].color.cmyk) {
c[i].push(cS[0].color.cmyk[j])
}
S[0].remove(), c[n = +!S.length].pop()
str += c[n].join(', ') + ' & '
}
alert(str.slice(0, -7))
}
Copy link to clipboard
Copied
Thank you Kukuryks. I'll have a look at this later today.
I greatly appreciate you posting a solution, Cheers.
Copy link to clipboard
Copied
So was my script useful for you?
Copy link to clipboard
Copied
Do you wish to “capture” the color sampler values and store them in a variable and or use the sampled values in some other way?
Copy link to clipboard
Copied
How might I do this?
(Sorry reviving and old thread)
Copy link to clipboard
Copied