The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   Scripting: names for line endings & colors (http://forums.omnigroup.com/showthread.php?t=25514)

Sophie 2012-09-16 05:06 PM

Scripting: names for line endings & colors
 
I am writing some scripts for Omnigraffle, and cannot figure out two things:

- What are the string names for the line endings (e.g. different arrowheads)? I need to specify head_type and tail_type for my lines.

- How do I specify a color value (e.g. for a line color)? It seems to be a non-string type.

I am using Python, but advice in any form is welcome!!

Thanks!

RobTrew 2012-09-16 11:46 PM

A route through such mazes is:
[LIST][*]Manually create samples (e.g with desired colors and line endings) in OmniGraffle[*][B]Edit > Copy As > Applescript[/B] from the OmniGraffle main menu.[*]Paste into an editor[*]If actually using AS, then edit the application line to something that works (long standing bug)[*]Inductively derive what is needed in Python etc[/LIST]
Thus, for example, I get:
[CODE]tell application id "OGfl"
tell canvas of front window
make new line at end of graphics with properties {point list: {{228.6165, 176.2299}, {371.6144, 174.2159}}, stroke color: {0.077786, 0.134208, 0.663366}, head type: "EmptyCenterBall", tail type: "StickArrow"}
make new line at end of graphics with properties {point list: {{224.6235, 150.0542}, {367.6215, 148.0401}}, stroke color: {0.360784, 0.407843, 0.505882}, head type: "UMLInheritance", tail type: "FilledCenterBall"}
make new line at end of graphics with properties {point list: {{219.5532, 123.8785}, {362.5512, 121.8644}}, stroke color: {1.000000, 0.000000, 0.000000}, head type: "Arrow", tail type: "FilledArrow"}
end tell
end tell
[/CODE]

Sophie 2012-09-17 06:36 AM

[QUOTE=RobTrew;114609]
[CODE]
stroke color: {0.077786, 0.134208, 0.663366},
head type: "EmptyCenterBall", tail type: "StickArrow"
[/CODE][/QUOTE]

[Edit] The line endings work great, the color works great, thanks!

Do you know of a way to access the automatic layout settings? The Copy As Applescript does not seem to get that.

RobTrew 2012-09-17 11:39 AM

[CODE]tell application id "OGfl"
tell canvas of front window

set (automatic layout of its layout info) to false

end tell
end tell[/CODE]

Sophie 2012-09-23 09:26 AM

Thanks, rob!

This got me started nicely, and I am now starting to make my way around ASDictionary-generated documentation. Thanks a bunch.


All times are GMT -8. The time now is 05:24 AM.

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