# Duplicate

The duplicate method is for duplicating tagged artwork, a target can be given, to specify the exact z position of the duplicates, i.e. where the duplicated appears on the layer panel. The duplicates x and y coordinates can then be controlled using other methods like, distribute, align, move and transform.
For duplicating layers see the Layer Methods. For duplicating artboards see the Artboard Methods.

# Basic Duplicate Operations

To duplicate tagged artwork, simply provide a tagSearch, using either the top line of the table header or the tagSearch property. If you use the header to set the tagSearch and don't provide any other properties for the method, you should put tagSearch or * in the method's property cell. The default location for the duplicates is the front of the document. Use the layerName and layerNumber properties to limit the tagged artwork to be duplicated from specific layer.

# Target and Location

To duplicate the artwork to a specific z position, set a targetTagSearch and / or a targetLayerName or targetLayerNumber and set the relative location.
For example tagSearch: cat location: below targetTagSearch: tree targetLayerName: Background Scene.
Set the location value to aboveAll or belowAll to duplicate the artwork at the top or bottom of the document.
Set the location value to top and bottom to duplicate the artwork to the top or bottom of a layer or group.
Set the location value to above and below to duplicate the artwork above or below a tagged target artwork or layer.
If there are multiple target matches, for example multiple artworks tagged tree in the above example. By default the cat will only be duplicated below the first tree. Set the useSingleTarget to false to duplicate the cat below each tree.

# Tags and Copies

Use the copies property to set how many duplicates you need.
Use the tags property to provide a list of tags to be applied to the original and duplicate artwork.
Use the seriesTag property to tag the original and duplicate artwork with an appended series number, and seriesStart to set the start number of the series. For example, searchTag: cat tags: duplicate, animal, seriesTag: tabby, seriesStart: 1, copies: 2, the original artwork will be tagged, cat duplicate animal tabby1 the first duplicate will be tagged cat duplicate animal tabby1 and the second duplicate cat duplicate animal tabby2
Set tagOriginal to false to not apply the tags and seriesTag to the original artwork.
Set replaceTags to true to replace and not append the tags on the original and duplicate artwork. In the example above, the original and duplicates would looe the cat tag if replaceTags was set to true.

# Example Spreadsheet and Screenshots

# duplicate.csv

cat cat
duplicate distribute
location copies seriesTag tagOriginal tags targetTagSearch: tree & left useSingleTarget replaceTags keyArt: distribute-bar tagSearch zOrder: true direction: h
above 2 tom
below 2
below 3 tom
above 3 FALSE tom tree TRUE tom
above 2 FALSE tom tree FALSE TRUE tom
Download: duplicate.zip
Download: duplicate.ai
Download: duplicate.csv

Compare each row in the spreadsheet below with its associated screenshot below. For illustrative purposes the distribute and nameByTags methods have been applied after the duplicate method.

Original Artwork

duplicate.ai File Before Duplicate and Distribute

Original Layer Panel

Original Layer Panel

Row 1 - Artwork

Artwork After Row 1

duplicate tagSearch: cat location: above copies: 2 seriesTag: tom keyArt: tree & left
distribute tagSearch: cat keyArt: distribute-bar z-order: true direction: h

Row 1 - Layer Panel

Layer Panel Row 1

Row 2 - Artwork

Artwork After Row 2

duplicate tagSearch: cat location: below copies: 2 keyArt: tree & left
distribute tagSearch: cat keyArt: distribute-bar z-order: true direction: h

Row 2 - Layer Panel

Layer Panel Row 2

Row 3 - Artwork

Artwork After Row 3

duplicate tagSearch: cat location: below copies: 3 seriesTag: tom keyArt: tree & left
distribute tagSearch: cat keyArt: distribute-bar z-order: true direction: h

Row 3 - Layer Panel

Layer Panel Row 3

Row 4 - Artwork

Artwork After Row 4

duplicate tagSearch: cat location: above copies: 3 tagOriginal: false keyArt: tree replaceTags: true
distribute tagSearch: tom keyArt: distribute-bar z-order: true direction: h

Row 4 - Layer Panel

Layer Panel Row 4

Row 5 - Artwork

Artwork After Row 5

duplicate tagSearch: cat location: above copies: 2 tagOriginal: false keyArt: tree useSingleTarget: false replaceTags: true
distribute tagSearch: tom keyArt: distribute-bar z-order: true direction: h

Row 5 - Layer Panel

Layer Panel Row 5

# Duplicate Properties

Mode Description
copies 
How many duplicates should be made.
Sample Values: 1, 5, 10
layerName 
The layer name containing the tagged artwork.
If no layer is provided then the tagged artwork will be duplicated regardless of it's containing layer.
Sample Values: Layer 1, Layer 2
layerNumber 
The layer number containing the tagged artwork.
If no layer is provided then the tagged artwork will be duplicated regardless of it's containing layer.
Sample Values: 1, 2
location 
Where the tagged artwork should be duplicated relative to the target.
Use aboveAll or belowAll to duplicate the artwork at the top or bottom of the document.
Use top and bottom to duplicate the artwork to the top or bottom of a layer or group.
Use above and below to duplicate the artwork above or below a tagged target artwork or layer.
Valid Values: aboveAll, belowAll, above [Default], below, top insideOnTop insideTop, bottom insideOnBottom insideBottom
replaceTags 
Whether the tags and seriesTag should replace or append the artwork's existing tags.
Valid Values: true, false
seriesTag 
A seriesTag allows easy targeting of the artworks. The original and duplicate artwork will be tagged with the given seriesTag with a series number added to each tag.
Sample Values: person, cat
seriesStart 
When a seriesTag is provided, a numbered tag will be added to the original artwork and each duplicate. If the seriesStart was set to 5 and the seriesTag was set to cat, then the original artwork would be tagged cat5 and the duplicates will be tagged in series cat6, cat7 etc. If tagOriginal was set to false then the original artwork will not be tagged cat5, the duplicates will be tagged cat5, cat6 etc.
Sample Values: 1, 5, 11
skip 
skip is a generic property for all methods, when set to true, the method will be skipped. See * and Skip for details.
Valid Values: true or false
tagOriginal 
Whether the original artwork should be tagged with provided tags and seriesTag.
Valid Values: true or false
tags 
A list of tags to be applied to the artwork.
Sample Values: animal, cat, tree, oak
tagSearch 
The tag search of the artwork to duplicate.
Sample Values: animal, animal | tree , cat & tabby, animal & !cat
targetLayerName 
The layer name that contains the artwork or the layer itself that the original artwork should be duplicated relative to. See useSingleTarget below.
Sample Values: Layer 1, Layer 2
targetLayerNumber 
The layer number that contains the artwork or the layer itself that the original artwork should be duplicated relative to. See useSingleTarget below.
Sample Values: 1, 2
targetTagSearch 
The tag search of the artwork that the original artwork should be duplicated relative to. See useSingleTarget below.
Sample Values: animal & !cat
useSingleTarget 
Whether only a single duplicate should be even if there are multiple targets. If set to false then duplicates will be made for each target match, otherwise only the first matching target will be used.
Valid Values: true, false