Omni Automation Video

009: (Quick Tip) Playground to Canvas
A short video showing the creation and use of a Shortcuts workflow for placing a shared image onto the current OmniGraffle canvas.

Related Links: (Podcasts)

Transcription: (no narration)

Omni Automation Script

A script that places the image passed to the Shortcuts action via the Share Sheet, into the currently selected shape on the OmniGraffle canvas. The image data passed to the shortcut via the Share Sheet is retrieved using the Associated Files argument.files parameter of the OmniGraffle “Omni Automation Script” action. (Documentation)

NOTE: If a single shape is not selected on the OmniGraffle canvas, the full size image will be added to the canvas at the page origin.

Place Shared Image


try { const imageData = argument.files[0] const sel = document.windows[0].selection if (sel.solids.length === 1){ sel.solids[0].image = addImage(imageData) } else { const cnvs = sel.canvas const solid = cnvs.newShape() solid.strokeThickness = 0 solid.shadowColor = null solid.fillColor = Color.white solid.image = addImage(imageData) const newGeometry = solid.geometry newGeometry.size = solid.image.originalSize solid.geometry = newGeometry } } catch(err){ new Alert(err.name,err.message).show() }