Created
November 3, 2011 03:50
-
-
Save vladocar/1335727 to your computer and use it in GitHub Desktop.
Make Guides Grid with units in Photoshop CS5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment