Automatically sequentially numbers selected shapes in OmniGraffle. It's rather complicated to figure out what order it should do them in!
After making the numbers the script selects them all, which is the ideal time to apply any style changes to them all at once. Alternatively, you can select them later, either using the selection palette, or by hitting the Select all in layer button when the appropriate layer is active.
For some reason there's a difference between a layer being selected and active in terms of selecting and adding things. The selected one is the one that looks selected. The active one is the one with the tiny pen next to it, which is also shown in the little layer menu, in the status bar, on the left of the image below.
If you want to delete all the numbers, because you've made some more shapes and all your numbers are out of sync, it's easiest to delete the entire "Automatically generated numbers" layer they've been made on.
If you try to run the script with a layer named "Automatically generated numbers" it'll complain at you. Two options: Re-name the layer to something else, or delete it.
By default the script considers shapes to be in the same row if they're offset vertically no more than half the average height of all the shapes you're numbering. (See offset_tolerance below.)
In the example shown here shape 2 is 2, rather than being 1. Even though it's higher up than the other everything else, it's not high enough to not be associated with the other blue ones.
The little black-sheep-type-thing, number 9, is number 9 rather than 8 as it's more than 50% of the average height of all the shapes lower down than the green ones.
This all works quite nicely in a lot of cases, but may produce unexpected, confusing, or just plain wrong results if you have lots of shapes with very different sizes.
The script's been made (for a change) to be quite easily changeable by people who really don't understand what's going on, like me when I look it about a week from now. Double-click on the script file, and it should open in Script Editor. The following are right at the top of the script:
© 2024 — 83957jgtyd@liamekaens.com