Script: Copy Selected Solids Text as Names


#1

Here a script to copy the text of all selected Solids as there name:

// COPY & PASTE into editor app. EDIT & SAVE with “.omnijs” file extension.
/*{
	"type": "action",
	"targets": ["omnigraffle"],
	"author": "Gerd Weckenmann",
	"identifier": "com.gwecken.CopySolidsTextAsNames",
	"description": "Copy the texts from multiple selected solids as there name.",
	"label": "Copy Solids Text as Names",
	"paletteLabel": "Copy Solids Text as Names"
}*/
var _ = function(){
	var action = new PlugIn.Action(function(selection, sender){
		// action code
		// selection options: canvas, document, graphics, lines, solids, view
		selection.solids.forEach(function(shape){

      if(shape.text != null) {
				shape.name = shape.text
			}
		})
	});

	action.validate = function(selection, sender){
		// validation code
		// selection options: canvas, document, graphics, lines, solids, view
		if(selection.solids.length > 0) {return true}
      else {return false}
	};

	return action;
}();
_;