Plug-In: Canvases From Copied List

This plug-in creates a new canvas for each of the paragraphs of the clipboard text. NOTE: empty or blank paragraphs are ignored.

Return to: OmniGraffle Plug-In Collection

Canvases From Copied List
  

/*{ "type": "action", "targets": ["omnigraffle"], "author": "Otto Automator", "identifier": "com-omni-automation.og.canvases-from-copied-list", "version": "1.0", "description": "Creates a new canvas for each of the paragraphs of the clipboard text.", "label": "Canvases from Copied List", "shortLabel": "Canvases from List", "paletteLabel": "Canvases from List", "image": "square.3.layers.3d" }*/ (() => { const action = new PlugIn.Action(async function(selection, sender){ try { const clipboardText = Pasteboard.general.string; const arrayOfStrings = clipboardText .split('\n') .map(item => item.trim()) .filter(item => item.length > 0); for (const itemStr of arrayOfStrings){ addCanvas().name = itemStr; }; } catch(err){ new Alert(error.name, err.message).show() console.error(err) } }); action.validate = function(selection, sender){ return Pasteboard.general.hasStrings; }; return action; })();