The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   Applescript: How to create a group or subgraph? (http://forums.omnigroup.com/showthread.php?t=27173)

Sophie 2012-11-24 08:35 AM

Applescript: How to create a group or subgraph?
 
The only way I have had luck with so far is to make the shapes directly on the canvas, and then use [B]assemble[/B] to put them into a subgraph or group.

Is there a way to [B]create[/B] new shapes with [B]at=aSubgraph.graphics.end[/B]? 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!

RobTrew 2012-11-26 07:12 PM

[CODE]set theResult to [B]assemble[/B] [I]reference[/I]
subgraph [I]boolean[/I]
table shape [I]list[/I][/CODE]

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.

RobTrew 2012-11-27 01:19 AM

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[/CODE]

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 [B]Help > Send Feedback[/B] 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
[/CODE]

[COLOR="White"]--[/COLOR]


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

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