Tonight for the first time I read the Adobe CS3 "Scripting Guide" pdf and gave it a go...
Patty made a cool template which we use with our button making machine. It is always tedious to copy and paste a grid of buttons once you are happy with once instance...
So I wrote this script which works with her template.
function not(value){
return ! value;
}
var layers = app.activeDocument.layers;
var layer = layers["Place Photo Here"];
if(layer == null || not(layer.locked)){
var origional = layer.placedItems[0];
for(var row = 0; row < 5; row++){
for(var col = 0; col < 4; col++){
if(row == 0 && col == 0){
//this is where original lives...
}else{
var aCopy =origional.duplicate();
aCopy.left = origional.left + (col * 135);
aCopy.top = origional.top - (row * 135);
}
}
}
}else{
alert("Expected a Layer \"Place Photo Here\"\nTo exists and be unlocked");
}
Labels: adobe javascript automation


