Using Alchemist and batchPlay I had no trouble GETTING the guides color, but I’m having a heck of a time SETTING it. I started with this:
async function setGuidesColor(color) {
const result = await batchPlay(
[
{
_obj: "set",
_target: [
{
_ref: "property",
_property: "guidesPrefs"
},
{
_ref: "application",
_enum: "ordinal",
_value: "targetEnum"
}
],
to: {
_obj: "guidesPrefs",
guidesColor: {
_enum: "guideGridColor",
_value: "mediumBlue" //temporary for testing
}
},
_options: {
dialogOptions: "dontDisplay"
}
}
],{
synchronousExecution: false,
modalBehavior: "wait"
});
}
but it crashed, so with my suspicions aroused I moved the batchPlay code into a function called setGuidesColorModal and did this:
async function setGuidesColor(color) {
try {
await require('photoshop').core.executeAsModal(setGuidesColorModal,
{"commandName": "Setting guides color",
descriptor: {setColor: color} //not yet really using this during testing
});
}
catch(e) {
utls.showAlert(e.message);
}
}
but that threw “The command failed because Photoshop is in a modal state”. The only UI features open are PS’s main window, the UXP Developer Tool, and a non-modal panel for the plugin where I click a button that starts a fairly simple sequence of code to do the following:
utls.setGuidesColor("lightBlue");
utls.showAlert(utls.getGuidesColor());
I’m at my wits end. Any help will be appreciated.