Numbering boxes
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 [/CODE] |
All times are GMT -8. The time now is 09:36 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.