Copy link to clipboard
Copied
Hi there,
I can't not find stringIDToTypeID() argument in ADOBE PHOTOSHOP CS6 SCRIPTING GUIDE and ADOBE PHOTOSHOP JAVASCRIPT SCRIPTING REFERENCE.
How can I find stringID list,like "placedLayerEditContents","patternFill","targetLayers" ?
thanks ![]()
You can find most of them here:
http://ps-scripts.cvs.sourceforge.net/viewvc/ps-scripts/xtools/xlib/PSConstants.js
This includes everything up through PS CC. I'll do an update for CC 2014 when I get a chance.
This probably does not include stuff that is loaded dynamically or in 3rd part plugins.
If anybody has a more complete list, please let me know so I can update this file.
-X
Copy link to clipboard
Copied
do you really mean Javascript or perhaps ScriptListener-Code (AM-Code) ?
Copy link to clipboard
Copied
You can find most of them here:
http://ps-scripts.cvs.sourceforge.net/viewvc/ps-scripts/xtools/xlib/PSConstants.js
This includes everything up through PS CC. I'll do an update for CC 2014 when I get a chance.
This probably does not include stuff that is loaded dynamically or in 3rd part plugins.
If anybody has a more complete list, please let me know so I can update this file.
-X
Copy link to clipboard
Copied
AFAIK, Adobe does not provide a comprehensive documented list of these or the charIDs. I have a perl script that extracts the information from the PS dev kit and generates ths PSConstants file which I occasionally have to go in and tweak when new versions drop.
-X
Copy link to clipboard
Copied
Im really curious how you actually get all those commands. I was looking for Select All. tried most items i found with select in that file, but none work. Even though i thought it was "All" as it shows like that in the select menu, it did not work.
Copy link to clipboard
Copied
@
Im really curious how you actually get all those commands. I was looking for Select All. tried most items i found with select in that file, but none work. Even though i thought it was "All" as it shows like that in the select menu, it did not work.
By @schroef
When I look at the recorded SL code:
var idset = stringIDToTypeID( "set" );
var desc202 = new ActionDescriptor();
var idnull = stringIDToTypeID( "null" );
var ref16 = new ActionReference();
var idchannel = stringIDToTypeID( "channel" );
var idselection = stringIDToTypeID( "selection" );
ref16.putProperty( idchannel, idselection );
desc202.putReference( idnull, ref16 );
var idto = stringIDToTypeID( "to" );
var idordinal = stringIDToTypeID( "ordinal" );
var idallEnum = stringIDToTypeID( "allEnum" );
desc202.putEnumerated( idto, idordinal, idallEnum );
executeAction( idset, desc202, DialogModes.NO );
If I insert the menu item into an action and look at the SL recording, it's the same.
If I convert the action step into JS via xtools:
#target photoshop
//
// Action2.jsx
//
//
// Generated Sat Oct 14 2023 12:57:51 GMT+1100
//
cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
//
//==================== Action 2 ==============
//
function Action2() {
// Set
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putProperty(cTID('Chnl'), sTID("selection"));
desc1.putReference(cTID('null'), ref1);
desc1.putEnumerated(cTID('T '), cTID('Ordn'), cTID('Al '));
executeAction(cTID('setd'), desc1, dialogMode);
};
step1(); // Set
};
//=========================================
// Action2.main
//=========================================
//
Action2.main = function () {
Action2();
};
Action2.main();
// EOF
"Action2.jsx"
// EOF
So perhaps it isn't that simple compared to DOM code.
Copy link to clipboard
Copied
@Stephen 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.
Copy link to clipboard
Copied
@Stephen 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! :]
Copy link to clipboard
Copied
That's I skipped that last when trying
Copy link to clipboard
Copied
Thanks everyone ![]()
ScriptListener plug-in solved my problem.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now