Been trying to use the guides class to create guides on the fly in code and it kept crashing. Did some experimenting; see my comments in the code below:
async function createDocumentForPOD(executionContext, descriptor) {
const app = require("photoshop").app;
//app.activeDocument.guides.removeAll(); //This works
var trimWin = 6.00;
var trimHin = 9.00;
var trimDpi = 300;
var trimWpx = trimDpi * trimWin;
var trimHpx = trimDpi * trimHin;
let newDoc = await app.documents.add({
width: trimWpx,
height: trimHpx,
resolution: trimDpi
});
newDoc.guides.add('horizontal', 75); //This works
newDoc.guides.add('vertical', 75); //This works
newDoc.guides.add(Constants.Direction.HORIZONTAL, 75); //This fails and crashes
app.activeDocument.guides.add(Constants.Direction.HORIZONTAL, 75); //This fails and crashes
return newDoc;
}
Here’s a cut and paste from the documentation explaining how to add new guides:
app.activeDocument.guides.add(Constants.Direction.HORIZONTAL, 20);