max_johnson_7790531's profile
Champion

Champion

 • 

627 Messages

 • 

14.7K Points

Mon, Sep 10, 2018 5:12 AM

4

How to find ALL action manager stringID keys in jsx javascript

Eureka! I just had a fore-head-slapping, why-didn't-I-think-of-this-sooner moment today and I wanted to share... Maybe someone's already thought of this and I just couldn't find it.

Photoshop's Action Manager API is... not as well documented as we'd like. Getting a list of all available stringIDs or charIDs for javascripting in a given version of photoshop has been elusive... but no longer! 

Save this as logTerminology.jsx and run it in whatever version of photoshop you want. You get a list of every available stringID in that version of PS, dumped into Terminology.jsx on your desktop. It's quick and dirty, but you can dress up the "terms +=" bit to customize the output to something more consumable. 

Not tested on OSX.

------------------------------------
logTerminology();
function logTerminology () {
    var terms="";
    var stringID, line;
    for ( var i=0; i<9999;i++)
    {
        try{
            stringID = typeIDToStringID( i );
            if( stringID.length)
            {
                terms += stringID + "\n";
            }
        } catch (e){}
        
    }
    writeTerminology(terms);
}
function writeTerminology( terminologyList ){
    // write generator config file
    var terminologyFile = new File("~/Desktop/Terminology.jsx");
    // Write to file
    if ( !terminologyFile.open( 'w' ) )
    {
      $.writeln( "Unable to open file\"" + terminologyFile + "\": " + terminologyFile.error + "." );
    }
    else if ( !terminologyFile.writeln( "" + terminologyList ) )
    {
      $.writeln( "Unable to write to file\"" + terminologyFile + "\": " + terminologyFile.error + "." );
    } else {
        
        $.writeln ("Successfully created "+terminologyFile.fsName);
        terminologyFile.close();
    }
}

----------------------

Sadly, it still can't tell you what each of those is actually for but it's a start...

Responses

959 Messages

 • 

15.3K Points

3 y ago

StringIDs are dynamically asigned. So they have order number once they are used. After PS start it is about 3600 but if will use it longer and try a lot different features then the number will grow.

And some CharID doesn't have StringID.

631 Messages

 • 

9.7K Points

3 y ago

I wrote something similar 1,5 year ago. I don't know it gives the same results and same amount of outputs. You may compare boths scripts, however once I used yours and it yielded quite many...

https://forums.adobe.com/thread/2254681

126 Messages

 • 

2K Points

3 y ago

I use Textpad as a Notepad remplacement and has a sort lines option which makes viewing the output more meaningful. FYI.
RONC

631 Messages

 • 

9.7K Points

3 y ago

I voted, but to be honest I don't know for what :)

Champion

 • 

627 Messages

 • 

14.7K Points

3 y ago

Interesting... I dig through Adobe's Photoshop SDK header files and found the char codes all referenced in the PITerminology.h file. This is a warning at the top of that file...:

//*****************************************************************************
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
//
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
//
// This file should NO LONGER BE USED to define OSTypes for keys, classes,
// enumeration types, and enumeration values. It exists only for backward
// compatibility. 
//
// Add names of new events, keys, classes, enum types and enum values to
// PIStringTerminology.h
//
// The aete resource, which referenced these keys, IS BEING
// DELETED. A Pate resource is being used instead (see UActionsTerminology.r
// for the format). This resource identifies items with strings instead
// of OSTypes. New APIs support construction and
// access of descriptors with strings instead of OSTypes. If you need to
// find the string equivalent of an OSType from this table, you can look
// in UActions.cpp. If you need to look it up the string corresponding to
// an ID at runtime inside the app, you can use:
// charPtr = GetStringIDMap ()->Find (DescType)
// From a plugin, use StringIDToTypeID in the ActionControlSuite or the
// BasicActionControlSuite
//
// The symbols in this file are still needed for forms, types, and units,
// and so that existing code which references them will still work. But 
// NEW CODE SHOULD USE THE STRING-BASED APIs and define the string constants
// in PIStringTerminology.h