I am trying to find the ColorSpace of the Active document.
Using the Alchemist Plugin in Inspector Mode I get the following
In my UXP Plugin I have the following
const app = require(“photoshop”).app;
const activeDoc = app.activeDocument;
console.log(activeDoc.mode);
But this is not returning anything, can anyone tell me what I am doing wrong please ?
Ian
Jarda
November 1, 2020, 8:08pm
2
Mode is currently not supported in DOM. https://www.adobe.io/photoshop/uxp/ps_reference/classes/document/
But you can work with it using batchplay.
I wondered whether it was supported or not.
With regards to BatchPlay, I am getting familiar with making recording actions but I cannot figure it out how to use the BatchPlay to get information like in this scenario where I want to see what mode the current Document is in ( RGB or GrayScale)
Ian
Jarda
November 1, 2020, 8:20pm
4
Just switch into “code” tab and there should be generated code to get it.
I can see the generated code ok but what I cant get to grips with is how to manipulate it.
I have a function called Mode which calls the test function
async function Mode() {
const app = require(“photoshop”).app
const result = await test()
console.log(result)
}
In the test function, I have the generated code from Alchemist
async function test() {
const batchPlay = require(“photoshop”).action.batchPlay;
const result = await batchPlay(
[
{
“_obj”: “get”,
“_target”: [
{
“_property”: “mode”
},
{
“_ref”: “document”,
“_id”: 1045
}
],
“_options”: {
“dialogOptions”: “dontDisplay”
}
}
],{
“synchronousExecution”: false,
“modalBehavior”: “fail”
});
}
What I dont understand at this time is how to return whether this document is grayscale or RGB
Maybe someone could show some example code to learn from
Ian
Jarda
November 1, 2020, 9:48pm
6
test()
should return result but your not return anything. Therefore logged value is undefined.
],{
“synchronousExecution”: false,
“modalBehavior”: “fail”
});
return (result)
}
Should I be returning the result like this ?