I've seen many scripts out there trying to accomplish something similar, all of them with different and interesting approaches. I've definitely picked up a lot of ideas from these forums. I wasn't getting what I was looking for unfortunately, so I made my own module. This will mostly be used as a read-only JSON to look for the property that you need.
Here you will find the public repo for the project with all its information. Feel free to bring up ideas, bugs, compatibility issues, etc.
https://github.com/JavierAroche/descriptor-info
Here's an example of how to use it.
Usage
descriptorInfo.getProperties( desc );
// Sample code for getting Descriptor properties with getProperties
Code: Select all
// Include the descriptorInfo module
#include "~/Development/personal/descriptor-info/jsx/descriptor-info.jsx"
// ActionDescriptor example
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
// Retrieve its properties by running the getProperties function, passing the ActionDescriptor as a param
var descObject = descriptorInfo.getProperties( desc );
JSON object example: https://github.com/JavierAroche/descrip ... properties
Supported Descriptors
DescValueType.BOOLEANTYPE
DescValueType.CLASSTYPE
DescValueType.DOUBLETYPE
DescValueType.ENUMERATEDTYPE
DescValueType.INTEGERTYPE
DescValueType.LISTTYPE
DescValueType.OBJECTTYPE
DescValueType.REFERENCETYPE
DescValueType.STRINGTYPE
DescValueType.UNITDOUBLE
DescValueType.ALIASTYPE
DescValueType.RAWTYPE
Known Limitations
REFERENCETYPE Descriptors will only return the Descriptor linked, but not it's actual properties. Adding this without properly testing can fall in an endless loop.
RAWTYPE Descriptors, usually labeled "legacyContentData", will return the value as unicode. You will have to parse it separately as the data varies too much.
Hope you guys find this useful and helps you better understand Action Descriptors. Feedback is always appreciated.
PS. If you're using my Brackets-to-Photoshop extension, you can use the console.stringify function to print out the JSON descriptor to the console.
https://github.com/JavierAroche/brackets-to-photoshop
Code: Select all
// Retrieve its properties by running the getProperties function, passing the ActionDescriptor as a param
var descObject = descriptorInfo.getProperties( desc );
console.stringify( descObject );