The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Align placed images to top edge Thread Tools Search this Thread Display Modes
Is there a way to have placed images align to top edge rather than the default center? I ask because I constantly have to revise the top edge % for each graphic individually and it would be a lot easier if I could simply select all objects with placed images and tell it to align to the top edge.
 
Not sure what your work-flow is, but you may find some reusable elements in this script:

Code:
property pTitle : "Place several images     Ver 0.8" -- IN OMNIGRAFFLE
property plngAcross : 4 -- number of thumbnails to place in a row
property prScale : 0.5 -- thumbnail size as a proportion of full size
property pblnShadow : false


--	Ver 0.6	Compatible with Launchbar's 'Instant Send' function
--				Select some files in the Finder, 
--				activate 'Send to' with a double-tap, 
--					Launchbar Preferences > Shortcuts > Modifier taps > Instant send
--				and select the script with its assigned abbreviation.


on run
	-- CHOOSE SOME IMAGES (SELECTING SEVERAL IMAGES FROM THE FILE DIALOG)
	tell application id "sevs"
		activate
		set lstFiles to (choose file with prompt "Place one or more images" with multiple selections allowed)
	end tell
	
	PlaceFiles(lstFiles)
end run

on open (lstFiles)
	PlaceFiles(lstFiles)
end open

on PlaceFiles(lstFiles)
	-- PLACE ALL THE SELECTED IMAGES IN A NEW DOCUMENT
	tell application id "OGfl"
		activate
		tell front canvas of (make new document with properties {automatic layout:false})
			set {rOriginX, rOriginY} to {0, 0}
			set lngMaxHeight to 0
			
			set i to 0
			set my text item delimiters to "/"
			repeat with oFile in lstFiles
				try
					-- GET THE DIMENSIONS OF THE IMAGE
					set strFile to POSIX path of oFile
					-- Image events
					tell application id "imev"
						tell (open file strFile)
							set {rX, rY} to dimensions
							close saving no
						end tell
					end tell
					
					-- SCALE DOWN TO THUMBNAIL
					set {lngWidth, lngHeight} to {rX * prScale, rY * prScale}
					
					-- AT THE END OF THE ROW RETURN TO LEFT HAND PAGE, AND MOVE DOWN A ROW
					if i ≥ plngAcross then
						set rOriginX to 0
						set rOriginY to rOriginY + lngMaxHeight
						set lngMaxHeight to 0
						set i to 0
					else
						-- RECORD THE MAXIMUM DEPTH IN THE CURRENT ROW OF THUMBNAILS
						if lngHeight > lngMaxHeight then set lngMaxHeight to lngHeight
					end if
					
					-- CREATE A THUMBNAIL with [folder/filename] of source image in url
					set strPathEnd to (items -2 thru -1 of (text items of strFile)) as string
					--make new shape with properties {origin:{rOriginX, rOriginY}, size:{lngWidth, lngHeight}, draws stroke:false, fill:no fill, draws shadow:pblnShadow, image:strFile, url:strPathEnd}
					make new shape with properties {origin:{rOriginX, rOriginY}, size:{lngWidth, lngHeight}, draws stroke:false, fill:no fill, draws shadow:pblnShadow, image:strFile, url:strFile}
					
					-- AND INCREMENT THE HORIZONTAL POSITION
					set rOriginX to rOriginX + lngWidth
					set i to i + 1
				on error
					display alert strFile & " does not appear to be a graphic file ..."
				end try
			end repeat
			set my text item delimiters to space
		end tell
	end tell
	
end PlaceFiles
 
OK this'll save some time for contact sheets I produce for showing screen templates, so thanks for that.

Do you happen to know about a script for changing default placement preferences for images to be top/left edge?
 
Quote:
Originally Posted by MatthewS View Post
Do you happen to know about a script for changing default placement preferences for images to be top/left edge?
You are talking about scaled images, and the top edge of shapes, rather than canvases ?
 
If so, something like this would resize the selected images, retaining the vertical position of their upper edge.

Code:
property prScale : 0.5

tell application id "OGfl"
	tell front window
		set lstSeln to selection
		repeat with oShape in lstSeln
			tell oShape
				if class is shape then
					set image sizing to stretched
					set {{rLeft, rTop}, {rWidth, rHeight}} to {origin, size}
					set rNewWidth to rWidth * prScale
					set origin to {rLeft + ((rWidth - rNewWidth) / 2), rTop}
					set size to {rNewWidth, rHeight * prScale}
				end if
			end tell
		end repeat
	end tell
end tell
--

Last edited by RobTrew; 2012-08-01 at 11:51 PM.. Reason: Adjusted code to maintain centring as well as top edge
 
I'm talking about the positioning in placed images set to 'Natural Size'. It's always positioned at the center. So that If I have placed an image (e.g. a screenshot of a top navigation element) and I need to reveal more of the image on one side, the whole thing will reposition, and I'll have to change the top % to fix it back in placed.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stretching and snapping to object edge jmca OmniGraffle General 0 2011-12-06 05:36 AM
Creating Omni : graphics that bleed to edge janedowling OmniGraffle General 1 2009-08-31 10:06 AM
Very Slow Syncing Over EDGE eecue OmniFocus Syncing 1 2008-07-25 11:15 PM
Is it possible to lock the right edge of an object? aarongustafson OmniGraffle General 5 2008-06-29 06:34 PM


All times are GMT -8. The time now is 09:25 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.