View Single Post
Am I doing something wrong?

I have a simple script, it creates 50-some boxes and lines between them. Looks basically like this:

tell application "OmniGraffle 5"
make new document with properties {template:"Blank"}
tell canvas of front window
set Node0 to make new shape at end of graphics with properties {text:{alignment:left, text:"nargle"}, origin:{100.0, 20.0}, autosizing:full}
set Node1 to make new shape at end of graphics with properties {text:{alignment:left, text:"fubar"}, origin:{100.0, 20.0}, autosizing:full}
set lineNode0Node1 to make new line at end of graphics with properties {head type:"FilledArrow", stroke pattern:1}
set source of lineNode0Node1 to Node0
set destination of lineNode0Node1 to Node1
// etc. etc. etc.
layout
end tell
save document 1 in "/tmp/userSelectedStudy.graffle"
close
end tell

What I find strange is that running this script takes like 8 seconds on my rather new MacBook Pro. That's not terribly long, but much longer than I expected for such a simple chart.

Is there a better way to create a chart programatically (my main program is generating and then executing the AppleScript)? (1) Are there different AppleScript commands I should use? (2) Am I better off using some technology besides AppleScript?

Thanks,
Chris