It seems like there is a command to access action step details, but I couldn’t find anything.
But there is an alternative to access action step details, using “copy as JavaScript” to extract details.
executeAsModal(async () => {
try {
// get a command string through ID 15010 in case of "copy as JavaScript"
const f = await core.getMenuCommandState({ commandID: 15010 });
const title = await core.getMenuCommandTitle({ commandID: 15010 });
// checking any an active action on action panel
if (f[0]) {
// executing "copy as a JavaScript" by ID
await core.performMenuCommand({ commandID: 15010 });
// reading command details through clipboard
const d = await navigator.clipboard.read();
const funcText = d["text/plain"];
// reading command details
console.log(funcText);
} else {
await app.showAlert("select any action on action panel.");
}
} catch (e) {
await app.showAlert(e);
}
}, {"commandName": "Action Commands"});
view raw
However, it reads as a string text, making me bit frustrated to analyse each detail.
You need to use RegExp or something…
// an exmaple, reading a curve action by using "copy as JavaScript"
async function curve() {
let commands = [
{
"_obj": "set",
"_target": [
{
"_enum": "ordinal",
"_ref": "adjustmentLayer",
"_value": "targetEnum"
}
],
"to": {
"_obj": "curves",
"adjustment": [
{
"_obj": "curvesAdjustment",
"channel": {
"_enum": "channel",
"_ref": "channel",
"_value": "composite"
},
"curve": [
{
"_obj": "paint",
"horizontal": 1.0,
"vertical": 0.0
},
{
"_obj": "paint",
"horizontal": 126.0,
"vertical": 128.0
},
{
"_obj": "paint",
"horizontal": 255.0,
"vertical": 255.0
}
]
}
]
}
}
];
return await require("photoshop").action.batchPlay(commands, {});
}
console.log(
await require("photoshop").core.executeAsModal(curve, {"commandName": "Action Commands"})
);