![]() That is, it’s a nearly universally agreed upon royal pain in the ass. Adding AppleScript support to an application, even with the pleasure/pain of Cocoa scripting, is as much of a rite of passage for developers as learning to write AppleScripts is for users. Apple is to blame for this, and they should step up and start taking responsibility. The place where your code just doesn’t stack up.ĭon’t beat yourself up. You can’t kill the guilt of that glaring omission – the horror of horrors. You’ve done a great job with your life! And then there’s that nagging in the back of your head. You’ve tackled lots of tough problems they’ve thrown your way. I can’t guarantee it will work with other versions.You’re a good developer. NOTE: It’s been tested only with Omnigraffle Pro 5. Here’s the script, which you are free to use or adapt for your own work in Omnigraffle. Any lines in the selection will be ignored. Also it works on all the shapes that are currently selected, so if nothing happens, check you have at least one shape selected. ![]() It can be applied to other shapes, but the distribution of the magnets will not be even, because of the distorted edge of the shape. Another point worth noting is that this script is intended to work with rectangles. It’s also worth noting that when corners are included and you have magnets on adjacent sides then the script is smart enough to place a single magnet at the shared corner – not two. If you select just one magnet per side including corners, then the magnet will be placed on the leading corner of the side as you progress round the shape in a clockwise direction. Some examples of different magnet configurations easily achieved with the script I’m starting with a large rectangle with no magnets, which I select before running the script: Since I’ve gone to the trouble of creating a script, I’ve also programmed it to give me the option of including the corners of the shape or not and of selecting which sides of the shape the magnets should be applied to. But frankly, who wants to waste their valuable time painstakingly placing individual magnets? Not me – that’s for sure.ĪppleScript to the rescue! Fortunately, Omnigraffle has excellent AppleScript support, so with an afternoon’s work I was able to create a script that would allow me to have an arbitrary number of magnets along the side of a shape. Yes, I know I can add further magnets manually, and yes, I know I could use a grid to ensure they are distributed evenly. ![]() For some types of diagram, circuit or logic diagrams in particular, I will often need more than five connections from the side of a shape. That being said, one limitation I’ve come up against is that Omnigraffle allows you a maximum of five magnets per side when you want to place and distribute them automatically. ![]() Connections, which are so often a source of frustration in other software, are a breeze in Omnigraffle and one of the features that makes them so easy is magnets. One of the areas where Omnigraffle really excels over other diagramming software is in its handling of connections. Like a lot of Mac users I’m a big fan of the Omni Group’s Omnigraffle. It’s included here for the benefit of Omnigraffle users who might want to develop something along similar lines. NOTE: This post was originally published in October 2013 and the script described here has not been tested with recent versions of Omnigraffle, AppleScript or Mac OS X and may not accurately describe current features of Omnigraffle.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |