OmniGraffle: Place Named Image
This is a shortcut for placing named images from your Photos collection into the current canvas of the frontmost OmniGraffle document.
↓ INSTALL SHORTCUT ••• ↓ DOWNLOAD SHORTCUT
The shortcut processes places named images in two ways:
- If a single solid shape is selected on the current canvas, the chosen image will be placed within the selected shape, and the text of the shape will become the title of the image.
- If no solid shapes are selected, a new shape sized to fit the dimensions of the chosen image will be added to the current canvas, and the text of the shape will become the title of the image.
The shortcut will present a image picker for the system Photos library. Metadata for the image, such as its name or title, can be entered in the pickers search field.
Once the image is chosen, a choose dialog displaying the image’s dimensions as well as the percentages to be used for for scaling the selected image.
Place Named Images |
A shortcut that places named images in the frontmost OmniGraffle document. |
|
Here is the Omni Automation script used to place the chosen image in the current canvas of the frontmost OmniGraffle document:
Place Named Image
try {
var imageData = argument.files[0]
var sel = document.windows[0].selection
var cnvs = sel.canvas
if (sel.solids.length === 1){
sel.solids[0].image = addImage(imageData)
sel.solids[0].text = argument.input
} else {
var solid = cnvs.newShape()
solid.strokeThickness = 0
solid.shadowColor = null
solid.fillColor = null
solid.image = addImage(imageData)
var newGeometry = solid.geometry
newGeometry.size = solid.image.originalSize
solid.geometry = newGeometry
solid.text = argument.input
}
} catch(err){
new Alert(err.name,err.message).show()
}