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

 
Applescript - 2 problems in linking two shapes with a line Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Not sure if others have found a solution to these two problems in scripting the creation of a line connecting two shapes.
  1. source and destination can apparently not be specified in the make new line property list.
  2. code-created links between horizontally aligned objects are not horizontal



Code:
property pstrArrow : "FilledArrow"
property plstRed : {65535, 0, 0}

tell application id "OGfl"
	tell (make new document)
		tell front canvas
			-- DISABLE AUTOMATIC LAYOUT
			set automatic layout of its layout info to false
			
			-- GET RELATIVE UNITS
			set {rX, rY} to page size
			set rSize to rX / 10
			set rDown to rY / 3
			
			set shapeA to make new shape with properties {name:"Circle", origin:{rDown, rDown}, size:{rSize, rSize}}
			set shapeB to make new shape with properties {name:"Circle", origin:{rDown + (rSize * 1.3), rDown}, size:{rSize, rSize}}
			
			-- PROBLEM 1: The following line of code fails ("AppleEvent handler failed") 
			
			-- 	set oLine to make new line with properties {source:shapeA, destination:shapeB, stroke color:plstRed, head type:pstrArrow}
			
			-- (source and destination can apparently not be specified in the initial property list, before the line has been created,
			-- Instead we have to create the line and THEN specify source and destination):
			set oLine to make new line with properties {stroke color:plstRed, head type:pstrArrow}
			tell oLine
				set source to shapeA
				set destination to shapeB
			end tell
			
			-- PROBLEM 2: The above creates a line which does NOT take the shortest (i.e. horizontal) path between the two shapes
			
		end tell
	end tell
end tell
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Odd behavior - line tool rearrances shapes? [A: template with auto-layout enabled was chosen] erickhill OmniPlan General 2 2012-06-27 02:02 PM
Problems with shapes and text invictus26 OmniGraffle General 1 2012-05-22 06:29 AM
Shapes with different line styles per side kelvSYC OmniGraffle General 0 2010-07-06 12:18 PM
Outliner line numbers in shapes? gandhi OmniGraffle General 0 2008-10-22 09:48 PM
Applescript first steps. Joining shapes with a curvy line ivanrostas OmniGraffle General 0 2007-10-31 03:08 AM


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


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