If, Then, based on layer name


is possible create script calls action based on layers name?

 

i have hundreds of image documents (layered psd's) need specific images inserted @ different scales.

i can make these individual actions, need beginning  "if part"

 

as example:

 

if layer called rn 100  call 1 action

if layer called rn 205 call action.

if there no recognizable layer name, closes document

 

thanks help

 

jeff

this basis of want:

it ignore background, need change script call actions need. @ moment calls "action1" & "action1". script doesn't take account groups of if  1 of layers variane asked ie "rn 100" or "rn 100"

 

var srcdoc = app.activedocument;

var numoflayers = srcdoc.layers.length;

 

// main loop starts here

for (var = numoflayers -2; >= 0  ; i--) //igore background

{

 

    srcdoc.activelayer = srcdoc.artlayers[i];

    var temp = srcdoc.artlayers[i].name

    if (temp == "rn 100")

    {

        // =======================================================

        var id156 = charidtotypeid( "ply " );

        var desc39 = new actiondescriptor();

        var id157 = charidtotypeid( "null" );

        var ref20 = new actionreference();

        var id158 = charidtotypeid( "actn" );

        ref20.putname( id158, "action1" ); // action 1 name

        var id159 = charidtotypeid( "aset" );

        ref20.putname( id159, "scripts" );

        desc39.putreference( id157, ref20 );

        executeaction( id156, desc39, dialogmodes.no );

    }

    else if (temp == "rn 205")

    {

        // =======================================================

        var id156 = charidtotypeid( "ply " );

        var desc39 = new actiondescriptor();

        var id157 = charidtotypeid( "null" );

        var ref20 = new actionreference();

        var id158 = charidtotypeid( "actn" );

        ref20.putname( id158, "action2" ); //action 2 name

        var id159 = charidtotypeid( "aset" );

        ref20.putname( id159, "scripts" );

        desc39.putreference( id157, ref20 );

        executeaction( id156, desc39, dialogmodes.no );

    }

    else

    {

        //close without saving

       app.activedocument.close(saveoptions.donotsavechanges);

    }

}//end loop

 

hope helps



More discussions in Photoshop Scripting


adobe

Comments

Popular posts from this blog

Joomla 3.3 Installation Error message - Joomla! Forum - community, help and support

Multilanguage infinite redirect loop error. - Joomla! Forum - community, help and support

trim media limit reached