Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Script for changing shape stroke color

New Here ,
Jul 22, 2023 Jul 22, 2023

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 ?

TOPICS
Actions and scripting
400
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 22, 2023 Jul 22, 2023
// 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();
      
...
Translate
Adobe
Community Expert ,
Jul 22, 2023 Jul 22, 2023
// 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) {}
};
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 22, 2023 Jul 22, 2023
LATEST

Just in case somebody stumbles over this topic and is also looking for a fill:

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines