Question
JS: Deleting Actions using Wildcard Variables.
I am working on a JS snippet that will delete action sets from the action pallete. The code will be ran from an AppleScript.
I used ScriptListener to get the basic code:
var id1 = charIDToTypeID( "Dlt " );
var desc1 = new ActionDescriptor();
var id2 = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var id3 = charIDToTypeID( "ASet" );
ref1.putName( id3, "Profile Actions_V4" ); //Action set being deleted
desc1.putReference( id2, ref1 );
executeAction( id1, desc1, DialogModes.NO );
It works, but I need to make the action set name a variable with a wildcard. So the string Profile Actions_V4 should be something like Profile Actions_V*. The number after the V is a version number, and the goal is to delete any possible versions the user has loaded into their actions palette.
I'm not into JS at all, so I'm thinking my problem may have to do with basic syntax, so I looked into regular expressions. Photoshop gave me this error:
Error 8800: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
- The object set RegExp is not currently available.
Line: 10
-> executeAction( id33, desc7, DialogModes.NO );
Thought? Thanks.
Carl.
I used ScriptListener to get the basic code:
var id1 = charIDToTypeID( "Dlt " );
var desc1 = new ActionDescriptor();
var id2 = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var id3 = charIDToTypeID( "ASet" );
ref1.putName( id3, "Profile Actions_V4" ); //Action set being deleted
desc1.putReference( id2, ref1 );
executeAction( id1, desc1, DialogModes.NO );
It works, but I need to make the action set name a variable with a wildcard. So the string Profile Actions_V4 should be something like Profile Actions_V*. The number after the V is a version number, and the goal is to delete any possible versions the user has loaded into their actions palette.
I'm not into JS at all, so I'm thinking my problem may have to do with basic syntax, so I looked into regular expressions. Photoshop gave me this error:
Error 8800: General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
- The object set RegExp is not currently available.
Line: 10
-> executeAction( id33, desc7, DialogModes.NO );
Thought? Thanks.
Carl.