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

Run action on my layers with jsx script

Community Beginner ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

Hello,

 

=> https://prnt.sc/10neg6m

=> https://prnt.sc/10neeio

 

"Edit_Recto" is my action that double click on the layers "RECTO_EDIT" that works good by running it manually, but I want to run it with JSX Script.

 

app.activeDocument.activeLayer = app.activeDocument.artLayers.getByName("RECTO_EDIT");
app.doAction("?", "?");

I have tested many things :
=> app.doAction("RECTO_EDIT", "Edit_Recto");
=> app.doAction("Edit_Recto", "RECTO_EDIT");
=> app.doAction("Action", "Edit_Recto");

but is not working..
if someone can help to fix this, would be amazing :)

Thanks you!

 

TOPICS
Actions and scripting

Views

528

Translate

Translate

Report

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 , Mar 16, 2021 Mar 16, 2021

The first parameter is  the name of the action, and the second is the set the action is saved in—reverse the parameters in your 3rd version:

 

 

var act = "Edit_Recto"
var actset = "Action"
    
app.activeDocument.activeLayer = app.activeDocument.artLayers.getByName("RECTO_EDIT");
app.doAction(act, actset);

 

 

Votes

Translate

Translate
Adobe
Community Expert ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

The first parameter is  the name of the action, and the second is the set the action is saved in—reverse the parameters in your 3rd version:

 

 

var act = "Edit_Recto"
var actset = "Action"
    
app.activeDocument.activeLayer = app.activeDocument.artLayers.getByName("RECTO_EDIT");
app.doAction(act, actset);

 

 

Votes

Translate

Translate

Report

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 ,
Mar 16, 2021 Mar 16, 2021

Copy link to clipboard

Copied

LATEST

Try this: put in the action set's name and the name of the action in the command to run the function.

 

playAction ('my action set', 'my action name')

function playAction(actionSet, actionName){
var idPly = charIDToTypeID( "Ply " );
    var desc2 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref1 = new ActionReference();
        var idActn = charIDToTypeID( "Actn" );
        ref1.putName( idActn, actionSet );
        var idASet = charIDToTypeID( "ASet" );
        ref1.putName( idASet, actionName );
    desc2.putReference( idnull, ref1 );
executeAction( idPly, desc2, DialogModes.NO );
}

Votes

Translate

Translate

Report

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