Thread: Center on page?
View Single Post
If it proves cumbersome to repeatedly:
  • group the selected shapes,
  • attend to the options of the alignment inspector,
  • and then ungroup,

you could assign a script to a keystroke or a Launchbar/Alfred trigger:

Code:
property pTitle : "Move selected graphics to centre of 1st canvas page"
property pVer : "0.01"
property pAuthor : "Robin Trew"

--CENTRE THE SELECTED BLOCK OF GRAPHICS ON THE FIRST PAGE OF THE OMNIGRAFFLE CANVAS

on run
	tell application id "OGfl"
		tell front window to set {oCanvas, lstSeln} to {its canvas, selection}
		
		-- FIND THE CENTRE OF THE SELECTION(S)
		
		-- Find horizontal and vertical minima and maxima of the selected shapes
		set {rXMin, rXMax, rYMin, rYMax} to {10 ^ 6, 0, 10 ^ 6, 0}
		repeat with oGraphic in lstSeln
			tell oGraphic to set {{rX, rY}, {rAcross, rDown}} to {origin, size}
			set {rRight, rBottom} to {rX + rAcross, rY + rDown}
			
			if rX < rXMin then set rXMin to rX
			if rRight > rXMax then set rXMax to rRight
			if rY < rYMin then set rYMin to rY
			if rBottom > rYMax then set rYMax to rBottom
		end repeat
		
		-- and derive an aggregate centre of the selected shapes
		set {rMidSeln_X, rMidSeln_Y} to {(rXMin + (rXMax - rXMin) / 2), (rYMin + (rYMax - rYMin) / 2)}
		
		-- GET THE X,Y DELTAS BETWEEN THE SELECTION(s) CENTRE AND THE PAGE CENTRE
		tell oCanvas to set {rPageAcross, rPageDown} to page size
		set {rDeltaX, rDeltaY} to {(rPageAcross / 2) - rMidSeln_X, (rPageDown / 2) - rMidSeln_Y}
		
		-- TRANSLATE THE POSITION OF EACH SELECTED SHAPE
		repeat with oGraphic in lstSeln
			tell oGraphic
				set {rX, rY} to origin
				set origin to {rX + rDeltaX, rY + rDeltaY}
			end tell
		end repeat
	end tell
end run