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: How to create a group or subgraph? Thread Tools Search this Thread Display Modes
The only way I have had luck with so far is to make the shapes directly on the canvas, and then use assemble to put them into a subgraph or group.

Is there a way to create new shapes with at=aSubgraph.graphics.end? Or to add existing shapes to an existing subgraph?

And lastly, is there a way for a script to select elements for auto-layout only of the selected ones?

Thanks!
 
Code:
set theResult to assemble reference ¬
     subgraph boolean ¬
     table shape list
On restricting auto layout on the basis of selection, I think you might have to create a temporary layer at run-time, to temporarily hold the subset (defined by selection status) which you want to lock or unlock for auto-layout.
 
This kind of code seems, as I think you have probably already discovered, to trip an exception:

Code:
tell application id "OGfl"
	tell canvas of front window
		set refSubGraphics to a reference to graphics of first item of subgraphs
		
		set oShape to make new shape at end of refSubGraphics with properties {size:{90, 90}}
	end tell
end tell
27/11/2012 10:13:29.247 OmniGraffle Professional: An exception was thrown during execution of an NSScriptCommand...
27/11/2012 10:13:29.247 OmniGraffle Professional: *** NSMapInsert(): attempt to insert notAKeyMarker

(Might be worth asking Help > Send Feedback whether that is by design)

but this seems to work:

Code:
tell application id "OGfl"
	tell canvas of front window
		set refSubGraphics to a reference to graphics of first item of subgraphs
		set oShape to make new shape with properties {size:{90, 90}}
		move (oShape) to end of refSubGraphics
	end tell
end tell
--

Last edited by RobTrew; 2012-11-27 at 01:36 AM..
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applescript return resources in group? dexterama OmniPlan Extras 3 2012-07-04 02:03 PM
omniplan applescript create milestones xtream OmniPlan Extras 1 2011-10-17 09:24 AM
Applescript to Create Repeating Tasks AgentsSka AppleScripting Omni Apps 6 2011-02-08 02:00 PM
Applescript question for Omni Group pvonk OmniFocus 1 for Mac 3 2009-10-06 09:16 AM
MailAction.applescript doesn't create anything in OF Dalmet OmniFocus 1 for Mac 8 2007-11-18 10:19 AM


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


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