The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   Automatically Diagram XML data? (http://forums.omnigroup.com/showthread.php?t=112)

jgerman 2007-03-23 05:51 AM

A more general question
 
I have a more general question along the same lines as this thread:

Is there a repository of information somewhere that describes how to control OmniGraffle from Applescript? I have several projects that fitting OmniGraffle into the tool chain would be perfect for and I'm willing to learn Applescript to do it, but I can't seem to find documentation of the interface to OG. Perhaps I'm looking in the wrong places?

jeremybrown 2007-03-23 06:02 AM

[QUOTE=jgerman]I have a more general question along the same lines as this thread:

Is there a repository of information somewhere that describes how to control OmniGraffle from Applescript? I have several projects that fitting OmniGraffle into the tool chain would be perfect for and I'm willing to learn Applescript to do it, but I can't seem to find documentation of the interface to OG. Perhaps I'm looking in the wrong places?[/QUOTE]

Well, there are a few ways to do this - the easiest is cribbing from other people's scripts, or recording your own actions with script editor (in /Applications/AppleScript/)

You can discover the controls yourself by looking at the OmniGraffle (or any other application's) dictionary.

Best way to do that is to open up XCode (with the developer tools) and click File->Open Dictionary... A list your applications folder comes up, and omnigraffle should be there. Open it, and it shows you all the commands that OmniGraffle knows about. You can do the same in script editor too, but it's a PPC binary, and I'm trying to stay away from those. Plus Script Editor doesn't produce universal binary output, but AppleScript Studio (in XCode) does, and yup - they tend to be faster!

Then alls you have to do is figure out applescript, but there's much in XCode's documentation and on apple's developer web site to help out there.

jgerman 2007-03-23 06:05 AM

[QUOTE=jeremybrown]Well, there are a few ways to do this - the easiest is cribbing from other people's scripts, or recording your own actions with script editor (in /Applications/AppleScript/)

You can discover the controls yourself by looking at the OmniGraffle (or any other application's) dictionary.

Best way to do that is to open up XCode (with the developer tools) and click File->Open Dictionary... A list your applications folder comes up, and omnigraffle should be there. Open it, and it shows you all the commands that OmniGraffle knows about. You can do the same in script editor too, but it's a PPC binary, and I'm trying to stay away from those. Plus Script Editor doesn't produce universal binary output, but AppleScript Studio (in XCode) does, and yup - they tend to be faster!

Then alls you have to do is figure out applescript, but there's much in XCode's documentation and on apple's developer web site to help out there.[/QUOTE]

Fantastic, thanks for the quick response. I was wondering if that was the method for discovering what's scriptable in an app or not. Guess I have another project to work on this weekend.

jeremybrown 2007-03-23 06:47 AM

Regarding the script I pasted in above - you'd do well to note that there's something like a 6:1 relationship of <loc></loc> tags to OmniGraffle objects. Somewhere around 1500 objects in OmniGraffle seems to be the practical limit of what you can call responsiveness. After that, the application becomes fairly sluggish (at least on my 2Ghz MacBook, with 2 GB RAM)

200 <loc> tags runs in mere minutes. 1100 tags requires hours.

You can optimize the script a little by commenting out/removing this bit:
[CODE]
if (urlsRead mod 10) is 0 then
tell canvas of front window
layout
page adjust
end tell
end if
[/CODE]

Then the layout will adjust only at the end. It's not as entertaining to watch, but then if you're doing a thousand-file site, you're probably not going to see anything in the upper-left corner of the document anyhow ;)

berchman 2007-05-01 01:14 PM

I try using this script but cannot get it to save.
I get this message when trying:

Expected variable name, class name or property but found application constant or consideration.

Can anyone help?

darvanitis 2008-11-26 08:02 AM

Hi Jeremy -- I tried your AppleScript for reading XML data into OmniGraffle. I have the latest version of OG (Pro, 5.1) and when I try to compile the script I get the syntax error, "A to:front can't go after this back." in reference to the "set children to back to front ordering" statement. Any ideas?

tobiasmay 2009-03-06 05:47 PM

*push*

if anybody got that script working again it would be pretty nice to see it updated here..

thanks in advance.

danden 2009-05-14 03:25 AM

Update
 
It would be great to see this updated, I'm on 5.1 and am having to same problem as above when compiling...

Anyone have an idea as to what's going wrong?

Cheers

halbtuerke 2009-08-21 01:26 AM

[QUOTE=darvanitis;51616]Hi Jeremy -- I tried your AppleScript for reading XML data into OmniGraffle. I have the latest version of OG (Pro, 5.1) and when I try to compile the script I get the syntax error, "A to:front can't go after this back." in reference to the "set children to back to front ordering" statement. Any ideas?[/QUOTE]
I just commented out that line (with -- in front) and it works fine.


Greetings

atourgates 2009-10-26 11:07 AM

Any Updates?
 
I'm trying to get the script to work, but not having success with my limited knowledge of Apple Script.

I compiled the script after commenting out the "set children" line, and that seemed to go OK. But after I saved the script as an application and ran it, nothing happened. I mean, the script ran for a second, then closed, without anything occurring.

I really would love to get this working. Any suggestions?


All times are GMT -8. The time now is 08:18 PM.

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