The below speaks in the context of AI Javascript. I don't mess with Applescript, and have only dinked around a little with VBA.
> Can the following procedure be automated?
> 1) Select the art on the dieline layer, group it, color it ZDIE, set it to a 1pt overprinting stroke.
Yes, this can be scripted.
This can also be automated by an Action, if you provide a way to isolate the paths you want selected (i.e., group them and give the group a name; hide all layers, then show just the die layer, then select all.)
> 2) Determine the size of the outer dimensions of the die (bounding box)...
Yes, this can be scripted.
The script can select and/or get the dimensions and position of objects (including groups) or selections. But...
> ...and change the document setup to (Width of die + 1/2") X (Height of die + 1/2") OPTIONAL: If wider than high, make the long side the height.
...this is where you get into problems. To my knowledge, the Artboard bounds are read-only properties in the scripting model, and cannot be changed for the current document. The workaround is to script methods of the app object to create a new document with the desired dimensions, select/copy/cut objects in the original document and paste into the new.
> 3) Select all art/layers, and center it to the artboard based on the bounding box of the die layer (so the die is centered, with 1/4" to the edge of the document on all sides), rotating all art if necessary, based on if the document width/height were flipped in step 2.
Yes, this can be scripted.
May be a bit involved, and possibly run slow, depending on how consistently the documents are structured. That is, if there is little consistency, the script may have to use several loops to cycle through all the objects in a layer, get their collective bounds, move them accordingly, etc.--in order to accommodate all carelessly-constructed caveats.
These things are not clear from your description:
You receive the documents that need to be reworked from outside sources, correct?
The recieved documents already have the appropriate diecut artwork in place, correct? If so, is the diecut artwork properly built? (That is, is it on its own layer; does it contain only the correct objects, do the paths already have the correct Appearnaces [stroke, weight, etc.]?)
Are all the diecuts the same, or do you have a collection of different ones?
If the diecut artwork is included in files from outside sources, where do the outside sources get the die cut artwork in the first place? If you provide them, why don't you provide them as template files that already have the diecuts correctly positioned on the correctly-sized Artboard?
Are other workarounds of the Artboard size problem vialble? For example, if the die cut path data is being sent to a plotter, does the diecut artwork really have to be
centered on the Artboard, or does the diecut artwork only need to have its
origin at .25Y, .25X relative to the Artboard origin? Or, would definition of a new Crop Area .25" beyond the bounds of the diecut artwork suffice instead of changing the size of the Artboard?
Have you fully explored a simpler macro-based (Actions) solution instead of scripting? For example, starting with a master file that contains only the proper diecut art and Artboard setup, it may be possible to batch-process an Action that:
1. Opens the first file that you store in an "Incoming" folder.
2. Unlocks all objects and layers.
3. Deletes the diecut layer.
4. Selects all.
5. Groups.
5. Copies.
6. Pastes into the master file.
7. Aligns to Artboard.
8. Saves to an "Output" folder.
9. Repeats for all the other files in the Incoming folder.
JET
... View more