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

How can I find stringIDToTypeID() argument?

New Here ,
Oct 03, 2014 Oct 03, 2014

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

TOPICS
Actions and scripting
4.1K
Translate
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

Advisor , Oct 03, 2014 Oct 03, 2014

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

Translate
Adobe
Community Expert ,
Oct 03, 2014 Oct 03, 2014

joehwang1234,

do you really mean Javascript or perhaps ScriptListener-Code (AM-Code) ?

Translate
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
Advisor ,
Oct 03, 2014 Oct 03, 2014

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

Translate
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
Advisor ,
Oct 03, 2014 Oct 03, 2014

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

Translate
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
Advisor ,
Oct 13, 2023 Oct 13, 2023

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. 

Translate
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 ,
Oct 13, 2023 Oct 13, 2023

@

quote

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.

Translate
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
Advisor ,
Oct 18, 2023 Oct 18, 2023

@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.

Translate
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 ,
Oct 20, 2023 Oct 20, 2023
quote

@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! :]

Translate
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
Advisor ,
Oct 23, 2023 Oct 23, 2023
LATEST

That's I skipped that last when trying

Translate
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
New Here ,
Oct 03, 2014 Oct 03, 2014

Thanks everyone

ScriptListener plug-in solved my problem.

Translate
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