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

 
Numbering boxes Thread Tools Search this Thread Display Modes
I have a chart with 800 boxes in a grid of 40x20. I would like to have them numbered 1-800. Is there any way to do this other than manually?

There is an "insert variable" function but nothing helpful there.

Thoughts?
 
If I needed to do this kind of thing regularly, I would probably use a script of some kind, roughly along these lines:

(Assumes that all the boxes have been given the "type"="box" key-value pair with the data inspector - you can do this as a batch by selecting them all, of course)

Code:
-- NUMBER BOXES SEQUENTIALLY BY COLUMN AND ROW
-- ASSUMES THAT ALL BOXES ARE TAGGED WITH INSPECTORS > NOTE > DATA KEY=TYPE > DATA VALUE=BOX


-- PROMPT USER FOR NUMBER OF COLUMNS
-- AND NUMBER OF ROWS
-- (SEPARATED BY A COMMA)
set {dlm, my text item delimiters} to {my text item delimiters, ","}
tell (display dialog "Enter number of cols and rows" & return & return & "(Two integers, separated by a comma)" default answer "")
	try
		set lstColRows to text items of (text returned)
		repeat with i from 1 to 2
			set item i of lstColRows to item i of lstColRows as integer
		end repeat
		set {lngCols, lngRows} to lstColRows
	on error
		return
	end try
end tell

-- MAKE A LIST OF EACH TAGGED SHAPE, WITH ITS ID AND HORIZONTAL AND VERTICAL POSITION
set my text item delimiters to tab
tell application id "OGfl"
	tell canvas of front window
		set {lstID, lstPosn} to {id, origin} of (shapes where value of user data item "Type" = "box")
		set strList to ""
		set lngID to length of lstID
		repeat with i from 1 to lngID
			set strList to strList & item i of lstID & tab & ((item i of lstPosn) as string) & linefeed
		end repeat
		
		-- SORT ALL THE SHAPES BY THEIR VERTICAL POSITION
		set my text item delimiters to linefeed
		set lstID to items 2 thru -1 of paragraphs of (do shell script "echo " & quoted form of strList & " | sort -n -k 3")
		
		-- ROW BY ROW, SORT THE SHAPES BY THEIR HORIZONTAL POSITION
		set lngPrev to 0
		repeat with iRow from 1 to lngRows
			set {lngFirst, lngLast} to {lngPrev + 1, lngPrev + lngCols}
			set lstRow to items lngFirst thru lngLast of lstID
			set lstRowID to paragraphs of (do shell script "echo " & quoted form of (lstRow as string) & " | sort -n -k 2 | cut -f 1")
			
			-- NUMBER THE MEMBERS OF THE SORTED ROW
			repeat with i from 1 to lngCols
				set text of (shape id ((item i of lstRowID) as integer)) to ((lngPrev + i) as string)
			end repeat
			set lngPrev to lngLast
		end repeat
	end tell
end tell

set my text item delimiters to dlm

Last edited by RobTrew; 2012-04-01 at 03:46 PM.. Reason: added "set my text item delimiters to dlm" to tidy up
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting rid of check boxes jojoba OmniOutliner 3 for Mac 7 2013-04-04 01:05 PM
Continuing numbering using legal outline numbering ianpiper OmniOutliner 3 for Mac 3 2011-08-17 01:33 PM
Boxes flying across the page - what the! Dekka17 OmniGraffle General 1 2009-12-30 01:57 PM
Hierarchical numbering vs flat numbering and sorting womich OmniOutliner 3 for Mac 1 2007-09-06 03:28 PM
Esc to leave input boxes zottel OmniWeb Feature Requests 1 2006-06-17 10:25 PM


All times are GMT -8. The time now is 02:25 PM.


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