The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Scripting: names for line endings & colors Thread Tools Search this Thread Display Modes
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!
 
A route through such mazes is:
  • Manually create samples (e.g with desired colors and line endings) in OmniGraffle
  • Edit > Copy As > Applescript 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

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

Last edited by RobTrew; 2012-09-16 at 11:51 PM..
 
Quote:
Originally Posted by RobTrew View Post
Code:
   stroke color: {0.077786, 0.134208, 0.663366},
   head type: "EmptyCenterBall", tail type: "StickArrow"
[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.

Last edited by Sophie; 2012-09-17 at 06:54 AM..
 
Code:
tell application id "OGfl"
	tell canvas of front window
		
		set (automatic layout of its layout info) to false
		
	end tell
end tell
 
Thanks, rob!

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom line endings? Sophie OmniGraffle General 1 2010-05-02 07:46 AM
Project Folder Names have bad names (equal signs)?!?! dschargel OmniFocus 1 for Mac 3 2010-02-18 11:54 AM


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


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