<NME> action-replicate-layers.cocoascript
<BEF> // @import 'actions/demo-inventory.cocoascript'

// generate code for layers
var runReplicateLayers = function() {
	StatisticsInventory.setStatus(Status.replicateID())
	FramerInventory.setUserSelection(currentSelection)

	[[NSPasteboard generalPasteboard] clearContents]

	var layers = []
	var pasteboardContent = ""

	var currentPage = FramerInventory.getCurrentPage()
	
	
	if (selection != nil) {
		var sortedSelection = FramerInventory.organiseSelection(selection)
		
		for (var i = 0; i < [sortedSelection count]; i++) {
			var currentLayer = [sortedSelection objectAtIndex: i]

	var sortedSelection = OrderInventory.removeDuplicatedLayers(currentSelection)
	if (sortedSelection == nil || sortedSelection.count() < 1) {
		[currentDocument showMessage:ViewInventory.smileWarning() + "Select layers"]
		return
	}

	if (!DemoInventory.isRegistered() && DemoInventory.actionsLeft() <= 0) {
		showExpiredModal()
		return
	}

	for (var i = 0; i < [sortedSelection count]; i++) {
		var currentLayer = [sortedSelection objectAtIndex: i]
		var layer = new Layer([currentLayer name])
		layer.composeState(currentLayer)
		layers.push(layer)
	}


	for (var i = 0; i < layers.length; i++) {
		pasteboardContent += layers[i].printLayer()
	}

	[[NSPasteboard generalPasteboard] setString:pasteboardContent  forType:NSStringPboardType];
	DemoInventory.actionUsed()
	FramerInventory.showDoneMessage()

	StatisticsInventory.setStatus(Status.waitingID())
	return pasteboardContent
}

<MSG> Proper size in export page for Replicate Layers

- less complex algorithm for Replicate layers action

<DFF> @@ -14,7 +14,7 @@ var runReplicateLayers = function(context) {
 	
 	
 	if (selection != nil) {
-		var sortedSelection = FramerInventory.organiseSelection(selection)
+		var sortedSelection = FramerInventory.cleanSelection(selection)
 		
 		for (var i = 0; i < [sortedSelection count]; i++) {
 			var currentLayer = [sortedSelection objectAtIndex: i]

Proper size in export page for Replicate Layers