Skip to main content
Participating Frequently
April 6, 2024
Answered

Need to copy the compound path and paste it to specific art boards

  • April 6, 2024
  • 1 reply
  • 684 views

Hi Team,

I am very new to this Adobe Illustrator Java Scripting language.



var doc = app.activeDocument;
var layers = doc.layers;

var desiredLayerName="Layer 1"
var targetLayer = layers.getByName(desiredLayerName);

var placedItem = targetLayer.placedItems;

if(placedItem.typename == "CompoundPathItem") {
  console.log("test");
}


// Example: Duplicate and place before a specific artboard (index 0)
var targetArtboard = doc.artboards[1];


I would like to paste this compound path to specific art board as shown above.
Can any one please help me with this query? I need the scripting code for the same.

Thank you

This topic has been closed for replies.
Correct answer Kurt Gold

Hi @Kurt Gold ,

I am very new to this scripting language, so for me writing a code is bit of task.
But I would be happy if I can find any code for specific ranges...

If you want me to open a new post for this question, I will do that.
I will close this thread by accepting your answer.

Thank you.


I've added a section where you can define specific artboards and ranges.

 

 

Download:

 

Paste Special with Range

 

Entering "1,3,6,8-12" in the Range text box should paste the current clipboard on artboard 1, 3 and 6 as well as on artboard 8 to 12.

 

Try it and report back if it works as expected.

1 reply

Kurt Gold
Community Expert
Community Expert
April 6, 2024

How would you expect this script should be working?

You select an object on an artboard, copy it and paste it at the same position on a specified artboard (that may be always the same, like artboard 3)? And with the same dimensions?

Or are you looking for something that lets you select any artboard of the current document to which the object should be  pasted at the same position? Probably with a modal dialog? If it should be with a modal dialog, how exactly should the modal dialog be constructed to suit your needs?

What should happen if some or all artboards have different dimensions?

And what else has to be considered to get it right according to your requirements?

Sorry to be a bit verbose about the requirements, but these kinds of thoughts arise when things are not clarified as needed to provide an appropriate approach.

Gopi99Author
Participating Frequently
April 7, 2024

Hi @Kurt Gold .

Thanks for your quick response.

Requirment:  We have a list of Artboards, and all of them will be having same dimensions. Our idea is to paste this Compound Path (basically looks like a border to Artboards/Pages) to specified Artboard/Artboards. In Adobe Illustrator GUI we can only find a option to paste this Compound Path to all the Art Boards, but not to a specific Art Board/Art Boards. We thought to write a script, so if you want to paste this Compound Path/ Border to even/odd order (specified) Art Boards/Pages. 

Hope you understood my requirment and I believe you can provide me some guidance to achieve my idea.
I will be waiting for your response.


Kurt Gold
Community Expert
Community Expert
April 7, 2024

I posted a similar script in this thread:

Paste Special

You may try it and check if it suits your needs.