Skip to content

Instantly share code, notes, and snippets.

@kazu69
Created April 13, 2012 00:10
Show Gist options
  • Save kazu69/2372064 to your computer and use it in GitHub Desktop.
Save kazu69/2372064 to your computer and use it in GitHub Desktop.
// check for document
if(app.documents.length > 0){
// get active document
var psDoc = app.activeDocument;
// get user input on column count
var colWidth = parseInt( prompt("Column size?", 5) );
var docWidth = psDoc.width;
// determine number of columns
var colCount = docWidth / colWidth;
// create vertical guidelines
for(i = 0; i <= colCount; ++i){
psDoc.guides.add(Direction.VERTICAL, i * colWidth);
}
var docHeight = psDoc.height;
// determine number of rows
var rowCount = docHeight / colWidth;
// create horizontal rows
for(i = 0; i <= rowCount; ++i){
psDoc.guides.add(Direction.HORIZONTAL, i * colWidth);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment