Skip to content

Instantly share code, notes, and snippets.

@MarshySwamp
Last active March 16, 2021 22:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarshySwamp/895140f2867fdad69efd5aedf5a70649 to your computer and use it in GitHub Desktop.
Save MarshySwamp/895140f2867fdad69efd5aedf5a70649 to your computer and use it in GitHub Desktop.
Code Snippet: Run Action
app.doAction("Molten Lead","Default Actions.atn");
// or
var actionName = "Molten Lead"; // Action to run
var actionSet = "Default Actions.atn"; // Action set to run
app.doAction(actionName,actionSet);
// or
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 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment