I'm moving my reply to your question in the other thread here for better organizational purposes. Let's leave that thread alone and answer your questions here.
Your question was:
Thank you so much... Now you have me thinking... I'm not overly familiar with scripts... but This type of set-up I'm creating we run into often... Can you let me know if this is something that could be accomplished in one step...
1. Run a script on an individual .tif or a folder of *.tif files
2. Open in Illustrator and place on a layer named "artwork"
3. Create a new layer named "Through Cut" and make a 1pt stroke that is .25" (H & W) less than the input file size (ie: input file is 48.25 x 96.25 rectangle would be 48 x 96 Centered) However I'd love it if the size could be determined from the input.
4. Do the layer flip like you previously assisted with putting Through Cut on Top / Artwork on Bottom
5. Print using a particular print preset (700 w-crops_Bleeds)
6. Flip the layers back to the order of Artwork on top and Through Cut on Bottom.
7. Save .pdf file (with PDF preset) with same name as input file.
8. Close
What I'm not sure of if it can handle the variable of input file being different sizes and creating the rectangle based off that...
Thanks again so much for your feedback... It's greatly appreciated.
Here's my answer:
I haven't worked with placing images via script so I don't know the gory details, but I don't see any reason that a script couldn't do all of the things that you're asking. It would take a decent amount of time and effort for me to experiment and determine what, if any, limitations there may be and unfortunately i don't have the requisite time available but there are tons of people here who have likely done all of the things you're looking for and they'll surely be glad to help you compile something that works for your purposes.
If you have any specific questions on how to execute any of those steps i'd be glad to help, but a good first step is to research each step individually and then work on piecing it all together.
Here's a freebie snippet that resizes the artboard to the size of the placed image, creates your artwork and through cut layers, and adds a rectangle to act as the Through Cut line with .25" bleed. (i wasn't sure whether you wanted .25" all the way around or if you effectively wanted .125" all around. All you need to do is change the value of "bleed" to 9 if you want 1/8th inch bleed on each side.)
function container()
{
var docRef = app.activeDocument;
var layers = docRef.layers;
var swatches = docRef.swatches;
var artboards = docRef.artboards;
var artLay, cutLay;
var bleed = 18;
//these next 5 lines assume an image has already been placed.
//you will need to make sure an image has been placed first or this will throw an error.
var theImg = docRef.placedItems[0];
theImg.left = 0;
theImg.top = 0;
var docSize = [theImg.width,theImg.height];
artboards[0].artboardRect = [0,0,docSize[0],-(docSize[1])];
function initLayers()
{
artLay = layers.add();
artLay.name = "Artwork";
theImg.moveToBeginning(artLay);
cutLay = layers.add();
cutLay.name = "Through Cut";
}
function addThroughCut()
{
var cutLine = cutLay.pathItems.rectangle(-(bleed),bleed,docSize[0]-(bleed*2),docSize[1]-(bleed*2));
cutLine.filled = false;
//this line assumes an existing spot color swatch called "Through Cut"
cutLine.strokeColor = swatches["Through Cut"].color;
}
initLayers();
addThroughCut();
}
container();