@Stephen_A_Marsh thanks for the reply. I was specifically looking at the codes runMenuItem. With this you can call menu commands using a single line of script, but you need to stringnames.
By @schroef
As previously posted, looking at the ScriptingListener recorded code, it isn't that simple, the required code is split on multiple lines of code.
Some menu items are simpler than others and only use a single code which can be accessed, such as Select All Layers:
var idselectAllLayers = stringIDToTypeID( "selectAllLayers" );
var desc264 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref4 = new ActionReference();
var idlayer = stringIDToTypeID( "layer" );
var idordinal = stringIDToTypeID( "ordinal" );
var idtargetEnum = stringIDToTypeID( "targetEnum" );
ref4.putEnumerated( idlayer, idordinal, idtargetEnum );
desc264.putReference( idnull, ref4 );
executeAction( idselectAllLayers, desc264, DialogModes.NO );
Which does easily translate to:
app.runMenuItem(stringIDToTypeID("selectAllLayers"))
But in the case of Select All, a single line of DOM code can do it anyway:
activeDocument.selection.selectAll();
I have given up on looking for or expecting consistency! :]
... View more