Question
Adjust script to add artboard guides instead of document guides
I have this script that someone shared with me a while ago to add guides to a selection, but when working with artboards, it creates document guides, not artboard guides. Is it possible to change that?
// Add guides to selection.jsx
//@target Photoshop
if (app.documents.length) {
// Get doc.
var doc = app.activeDocument;
if (doc.selection) {
// Get bounds of selection.
var bounds = doc.selection.bounds;
doc.selection.deselect();
// Add guides to match bounds of selection.
doc.guides.add(Direction.VERTICAL, bounds[0]);
doc.guides.add(Direction.HORIZONTAL, bounds[1]);
doc.guides.add(Direction.VERTICAL, bounds[2]);
doc.guides.add(Direction.HORIZONTAL, bounds[3]);
} else {
alert("Make a selection");
}
} else {
alert("Open a document");
}