Graffle API?

Ken Case kc at omnigroup.com
Thu Feb 2 09:58:26 PST 2006


On Jan 31, 2006, at 14:14 , Zachary Jones wrote:
> Is there an API or plug-in architecture for Graffle.  I'd like to  
> develop an importer (something that creates Graffle objects based  
> upon a file).  Is the Graffle file format documented somewhere?

OmniGraffle documents are written in a plain text format (an XML  
property list), but I don't believe we've documented it anywhere.  We  
have tried to make the format reasonably easy to read and write (we  
strongly believe that people should be able to access their own data  
without our tools), but we don't promise that we won't change the  
format at some point in the future.

> It's occurring to me that this could be done with applescript.

AppleScript is certainly the best supported interface for creating  
OmniGraffle documents.  To see how to create things using  
AppleScript, you can put together a document that looks the way you  
want, select everything in it, then use "Copy As AppleScript" (in the  
Edit menu) to put the equivalent AppleScript onto your pasteboard.   
Paste the resulting script into Script Editor, and presto!  You've  
now got a script which can recreate that document.

The only downside to AppleScript is that it isn't the fastest  
interface, so if you're important very large and complex documents it  
may be better to write out a file which OmniGraffle can read  
directly.  If the graphs don't need to be terribly pretty when first  
imported (you can always fix the formatting later), you could try  
writing out DOT files (which are documented at <http:// 
www.graphviz.org/doc/info/lang.html>)--though please bear in mind  
that there isn't a one-to-one correspondence between what you can do  
in DOT and what you can do in OmniGraffle.  (We've documented which  
parts of DOT OmniGraffle supports in the "Importable DOT Commands"  
section of OmniGraffle's Help.)

Hope this helps!

				Ken



More information about the OmniGraffle-Users mailing list