If you use my descriptor-info module, you can use the example JSX under the "example" folder, and replace the code in that JSX with this:
Code: Select all
// Include the JSON helper
#include "./helpers/JSON.jsx"
// Include the descriptor-info module
#include "../jsx/descriptor-info.jsx"
// ActionDescriptor example
var ref = new ActionReference();
ref.putProperty( stringIDToTypeID("property"), stringIDToTypeID("workspaceList") );
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var desc = executeActionGet(ref);
var descObject = descriptorInfo.getProperties( desc );
// Running in ExtendScript
$.writeln(JSON.stringify(descObject, null, 4));
This will get you the workspace list as an object. Unfortunately, it doesn't specify which one is selected, and I can't find that property.
This is the result object you would get:
Code: Select all
{
"workspaceList": [
{
"workspace": {
"displayName": "hello",
"name": "hello",
"user": true
}
},
{
"workspace": {
"displayName": "Essentials",
"name": "Essentials",
"user": false
}
},
{
"workspace": {
"displayName": "3D",
"name": "3D",
"user": false
}
},
{
"workspace": {
"displayName": "Motion",
"name": "Motion",
"user": false
}
},
{
"workspace": {
"displayName": "Painting",
"name": "Painting",
"user": false
}
},
{
"workspace": {
"displayName": "Photography",
"name": "Photography",
"user": false
}
},
{
"workspace": {
"displayName": "Typography",
"name": "Typography",
"user": false
}
}
]
}
You can achieve this without using the descriptor-info module, but you will need to manually loop through the descriptors in the list (contained in "desc" variable), to get each workspace properties.