How can I get the Photoshop JavaScript layer tags?

I asked this question to the graphics stack Exchange but they pointed me here:

http://GraphicDesign.StackExchange.com/questions/35374/how-do-i-get-the-Photoshop-layer-Ta gs-in-javascript? noredirect = 1 #comment48962_35374

I want to do actions based on the color of the layer labeled (these thing 1) in Photoshop. I can't find a property in the documentation of JavaScript or the ExtendScript Toolkit that can contain the value.

I'd rather do not abuse the name, layer tags look like a very clean to my problem solution. If only I could get.

Any ideas?

Kind regards

MII

Hi, these functions will select all layers with the specified color:

Use the command: selectAllByColor ("red");

function getIDXwithsameColor (TheColor) {/ / searches for and returns a list of indexes for the layers with the specified color}

Var ref = new ActionReference();

Iawf var = [];

try {activeDocument.backgroundLayer; var a = 0} catch (e) {var a = 1 ;};

While (true) {}

REF = new ActionReference();

ref.putIndex (charIDToTypeID ("Lyr"), one);

try {var desc = executeActionGet (ref) ;} catch (Err) {break ;}

CL var = desc.getEnumerationValue (charIDToTypeID ("Clr"));

CL = typeIDToStringID (cl);

ls var = desc.getEnumerationValue (stringIDToTypeID ("layerSection"));

LS = typeIDToStringID (ls);

If (ls! = 'layerSectionEnd') {}

if(CL == TheColor) {}

toRet.push (a);

}

}

a ++ ;

}

Iawf return;

}

function multiSelectByIDX (idx) {/ / function selection}

If (idx.constructor! = Array) idx = [idx];

var layers = new Array();

var / / desc = new ActionDescriptor();

Var ref = new ActionReference();

for (var i = 0; i)< idx.length;="" i++)="">

layers [i] = charIDToTypeID ("Lyr");

ref.putIndex (layers [i], idx [i]);

}

desc.putReference (charIDToTypeID ("null"), ref);

executeAction (charIDToTypeID ("TPCV"), desc, DialogModes.NO);

}

function selectAllByColor (TheColor) {/ / hand function}

theSameClIDX = (TheColor) getIDXwithsameColor;

multiSelectByIDX (theSameClIDX);

}

... example:

selectAllByColor ("none");

selectAllByColor ("red");

selectAllByColor ("orange");

selectAllByColor ("yellowColor");

selectAllByColor ("grain");

selectAllByColor ("blue");

selectAllByColor ("Purple");

selectAllByColor ("gray");

Tags: Photoshop

Similar Questions

Maybe you are looking for