public
Created — forked from vladocar/GuidesUnitGrid.js

Make Guides Grid with units in Photoshop CS5

  • Download Gist
GuidesUnitGrid.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
var doc = app.activeDocument;
var guides = app.activeDocument.guides;
var w = doc.width;
var h = doc.height;
 
function MakeGuidesGrid(unitVertical, gutterVertical, unitHorisontal, gutterHorisontal) {
if (unitHorisontal !== 0) {
var j = h / unitHorisontal;
for (var i = 0; i < j; i++) {
guides.add(Direction.HORIZONTAL, i * unitHorisontal);
guides.add(Direction.HORIZONTAL, i * unitHorisontal + gutterHorisontal);
}
}
if (unitVertical !== 0) {
var z = w / unitVertical;
for (var i = 0; i < z; i++) {
guides.add(Direction.VERTICAL, i * unitVertical);
guides.add(Direction.VERTICAL, i * unitVertical + gutterVertical);
}
}
}
MakeGuidesGrid(parseInt(prompt("Insert the Vertical unit", 40)), parseInt(prompt("Insert the Vertical gutter", 10)), parseInt(prompt("Insert the Horisontal unit", 40)), parseInt(prompt("Insert the Vertical gutter", 10)));
//MakeGuidesGrid(40,10,40,10)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.