Copy link to clipboard
Copied
Been googling for couple days but no such script exist on the internet i suppose.
How can I change selected activeLayer shape's stroke color with a .jsx script ?
// 2023, use at your own risk;
changeShapeLayerStrokeColor ([Math.random()*255,Math.random()*255,Math.random()*255]);
function changeShapeLayerStrokeColor (theRGBColor) {
try {
var desc8 = new ActionDescriptor();
var ref4 = new ActionReference();
ref4.putEnumerated( stringIDToTypeID( "contentLayer" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
desc8.putReference( stringIDToTypeID( "null" ), ref4 );
var desc9 = new ActionDescriptor();
...
Copy link to clipboard
Copied
// 2023, use at your own risk;
changeShapeLayerStrokeColor ([Math.random()*255,Math.random()*255,Math.random()*255]);
function changeShapeLayerStrokeColor (theRGBColor) {
try {
var desc8 = new ActionDescriptor();
var ref4 = new ActionReference();
ref4.putEnumerated( stringIDToTypeID( "contentLayer" ), stringIDToTypeID( "ordinal" ), stringIDToTypeID( "targetEnum" ) );
desc8.putReference( stringIDToTypeID( "null" ), ref4 );
var desc9 = new ActionDescriptor();
var desc10 = new ActionDescriptor();
var desc11 = new ActionDescriptor();
var desc12 = new ActionDescriptor();
desc12.putDouble( stringIDToTypeID( "red" ), theRGBColor[0] );
desc12.putDouble( stringIDToTypeID( "grain" ), theRGBColor[1] );
desc12.putDouble( stringIDToTypeID( "blue" ), theRGBColor[2] );
desc11.putObject( stringIDToTypeID( "color" ), stringIDToTypeID( "RGBColor" ), desc12 );
desc10.putObject( stringIDToTypeID( "strokeStyleContent" ), stringIDToTypeID( "solidColorLayer" ), desc11 );
var idstrokeStyleVersion = stringIDToTypeID( "strokeStyleVersion" );
desc10.putInteger( idstrokeStyleVersion, 2 );
desc10.putBoolean( stringIDToTypeID( "strokeEnabled" ), true );
desc9.putObject( stringIDToTypeID( "strokeStyle" ), stringIDToTypeID( "strokeStyle" ), desc10 );
desc8.putObject( stringIDToTypeID( "to" ), stringIDToTypeID( "shapeStyle" ), desc9 );
executeAction( stringIDToTypeID( "set" ), desc8, DialogModes.NO );
} catch (e) {}
};
Copy link to clipboard
Copied
Just in case somebody stumbles over this topic and is also looking for a fill:
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more