Copy link to clipboard
Copied
There does not seem to be a method to duplicate an artboard in Illustrator's scripting API. Artboards.add and Document.selectObjectsOnActiveArtboard can do something similar, but the developer needs to worry about whether the PageItem is editable.
Alternatively, it could find all PageItem's that are in the appropriate artboard area and duplicate them, but I don't want to do that.
I have tried to record the duplication of the artboard in an action, but it is not responding.
Is there any way to duplicate the artboard while programmatically specifying the coordinates of the artboard, without worrying about whether the artboard's contents are editable or not?
The reason I want to do that is because I want to change the position of the artboard as I wish, which will be generated by the artboard duplication.
Altough still you need to check locked layers, selecting Artboard Tool then, copying and pasting behave like "Duplicate Artboards" I supporse.
(function () {
app.selectTool('Adobe Crop Tool');
app.copy();
app.paste();
})();
Copy link to clipboard
Copied
unless there's a relatively new api method I don't know about, I duplicate artboards the way you described it. I duplicate each item on the artboard
Copy link to clipboard
Copied
Thank you for your response. There doesn't seem to be a way, but I will wait and hope that a more elegant way will be raised.
That being said, what are some of the factors that could cause a mistake in selecting and duplicating/translating the contents of the PageItems? For example the following, but what are the others?
Copy link to clipboard
Copied
oh damn, yeah it starts getting complicated quickly. Depending on the requirements, I don't deal with every possible scenario if I don't have to.
what if you
1. collect visible/lock info for each item in a layer
1.2 unlock/unhide all
2. select all
3. copy
4. Paste Remember Layers
5. switch to destination document
6. paste
7. restore visible/lock from saved info
guides could be excluded before copying
opacity mask are trouble
would that work?
Copy link to clipboard
Copied
Yes, it would be. My intention was to duplicate the artboards within the same document, but it will mostly be accomplished that way.
The `Unlock All` and `Show All` menu commands will select the PageItem that was the target of each, so it's relatively easy to restore.
If the script uses a manually reproducible method such as copy/paste, it may be possible to translate the opacity masks.
The problem is layers. This is prone to MRAP errors because the script has to check the locked/visible status of all layers one by one.
I will wait a little longer and if no direct means of using Duplicate Artboards can be found, I will try to develop based on your means. Because Duplicate Artboards has a `Move Locked and Hidden Artwork with Artboard` option.
Copy link to clipboard
Copied
Altough still you need to check locked layers, selecting Artboard Tool then, copying and pasting behave like "Duplicate Artboards" I supporse.
(function () {
app.selectTool('Adobe Crop Tool');
app.copy();
app.paste();
})();
Copy link to clipboard
Copied
Thanks for the idea.
Good news:
That way Duplicate Artboards can be reproduced.
Bad news:
The lock/visible state of the layers is a concern for the developer, as you said. The lock/hidden state of the guides also needs to be controlled by the developer.
It seems I was too overconfident with the `Move Locked and Hidden Artwork with Artboard` setting... I will develop it on my own, based on CarlosCanto-san's and Kawano Shuji-san's approach.
Copy link to clipboard
Copied
I submitted to UserVoice the Duplicate Artboards problem that motivated me to develop the script. Feel free to vote for it.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now