Script to create a Frame around Page?
I'm trying to create a script that creates a box/frame that does the following below numbered items. When i try to combine all the below i get all kinds of errors. I tried stripping away parts from other scripts i have and placing them in the script i'm trying to make but i'm having quite a hard time with it. Most of these documents have one page but there are a few that have 2 pages. Not all the documents that i'm adding these too will be the same size. all the pages in the documents will be the same as the first page.
1 Before the document is opened or created. automatically Create a Frame (Around the Page).
2 Put a overprint stroke (.0625in) around it "no fill".
3 Create a color (Lab or CMYK value)with a specific name in my case (Diecut)"and apply it to the above stroke.
4 and place it in its own layer.
I have some parts i think!
function moveLayer(){
layers = app.documents[0].layers;
if (layers.item('Diecut').isValid) {
layers.item('Diecut').move (LocationOptions.AT_END);
}
/* if (layers.item('Layer 1').isValid) {
layers.item('Layer 1').move (LocationOptions.AT_BEGINNING);
} */
}
I think this will create a layer?
function addLayer(doc, name){
try{
var layer = doc.layers.itemByName(name);
if(layer && layer.isValid) {
return layer;
} else {
var myLayer = doc.layers.add();
myLayer.name = name;
myLayer.layerColor = [100,100,100]
return myLayer;
}
} catch(e) {
}
}
This will move my text frame to the Layer
function move(event){
var doc = event.target;
if(!(doc && doc.constructor.name == "Document")) {
return;
}
var myLayer = addLayer(doc, "Diecut");
Thank you.