What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Reply to thread

What you could do is split your action into several actions that can be called from a script, here is a sample of code that should accomplish what you are after..


[CODE]

main();

function main(){

if(!documents.length) return;

var colour =new SolidColor();

//do the first part of shade analysids

app.doAction('ShadeAnalysis1', 'Default Actions');

//set the colour you want to select in hex

colour.rgb.hexValue = 'ff0000';

//select the colour range , fuzziness, inverse(true/false)

selectColourRange(colour,15,false);

//do the next part of the analysis

app.doAction('ShadeAnalysis2', 'Default Actions');

//select a different colour ??

//colour.rgb.hexValue = 'ff00ff';

//select the colour range with a different fuzziness

selectColourRange(colour,20,false);

//do another section of the analysis

app.doAction('ShadeAnalysis3', 'Default Actions');

selectColourRange(colour,25,false);

//repeat the above steps as required

};

function selectColourRange(clr, fuzz, inverse) {

var desc = new ActionDescriptor();

desc.putInteger(charIDToTypeID("Fzns"), fuzz);

var mnDesc = new ActionDescriptor();

mnDesc.putDouble(charIDToTypeID("Lmnc"), clr.lab.l);

mnDesc.putDouble(charIDToTypeID("A   "), clr.lab.a);

mnDesc.putDouble(charIDToTypeID("B   "), clr.lab.b);

desc.putObject(charIDToTypeID("Mnm "), charIDToTypeID("LbCl"), mnDesc);

var mxDesc = new ActionDescriptor();

mxDesc.putDouble(charIDToTypeID("Lmnc"), clr.lab.l);

mxDesc.putDouble(charIDToTypeID("A   "), clr.lab.a);

mxDesc.putDouble(charIDToTypeID("B   "), clr.lab.b);

desc.putObject(charIDToTypeID("Mxm "), charIDToTypeID("LbCl"), mxDesc);

if (inverse) {

desc.putBoolean(charIDToTypeID("Invr"), inverse);

}

try{

executeAction( charIDToTypeID('ClrR'), desc, DialogModes.NO );

}catch(e){}

};

[/CODE]


What is our favorite program/app? (Hint - it begins and ends with the letter P)
Back
Top