Hi All,
I'm extremely new to scripting; I managed to create a script to extend the artboard of my documents (which I was extremely proud of given my inexperience!) and another to align a couple of objects alongside each other, but my attempts to script some new code has met with failure.
Firstly, I need some Illustrator CS4 Javascript code that will create a bounding rectangle for the selected object(s). The selected object(s) will always be rectangular; no irregularly-shaped objects. I know this should be simple, but I can't work out the variables/attributes involved.
Secondly, some code to help selecting the leftmost object in a document. And the equivalent for the rightmost object.
If it makes any difference, I'll be stitching these scripts together with an action to achieve the following workflow.
- Two EPS files are dragged into an empty document as 'Linked Files'.
- The two Linked Files are aligned alongside each other. (Using a script I've already written.)
- The leftmost Linked File is selected and has a bounding rectangle created, which is then used to mask the Linked Object.
- The rightmost Linked File is then selected and has a bounding rectangle created, which is then used to mask the Linked Object.
- Both masked Linked Files are selected, and a bounding rectangle is created to mask them into the same Clipping Mask group.
- The artboard is set to the dimensions of this combined masked pair (I've managed to write that script already).
- The Linked Files are embedded into the document.
The reason for this is because we have EPS map files exported from AutoCAD that are left- and right-hand pages. These need to be combined into one file, but when they are brought in they lose their masks as the BBOX element is not recognised by Illustrator. The double-masking in my process above is needed to ensure that content from either map doesn't overlap the other half of the map.
Any assistance would be greatly appreciated, and sorry for the long-winded post!
Thanks,
WayneM@LP