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 > Developer > AppleScripting Omni Apps
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Getting Groups from Graffle Thread Tools Search this Thread Display Modes
Aargh. What am I doing wrong???

I have nested groups in an OmniGraffle document. The following code (and many variations thereof):

tell application "OmniGraffle Professional 5"
tell front document
tell canvas 1
set group_list to every group --gets top-level groups only?

repeat with a_group in group_list
set subgroup_list to {}
tell a_group to set subgroup_list to its every group
display dialog subgroup_list as text
end repeat

end tell
end tell
end tell

tells me that the variable subgroup_list is not defined.
At the very least, shouldn't it be defined as an empty list? (The "set subgroup_list to {}" line was a desperation measure that shouldn't be needed.)

More importantly, why is it not finding the subgroups in my groups?
 
If you specify a type for subgroup_list (change that line to "every group as list") your existing script won't throw that error. (at least on my 10.5.6 box, it doesn't.)

Since you're asking the canvas for a list of the groups that it contains, you're only getting the top level groups that are actually owned by the canvas.

We're quickly reaching the upper limit of my AppleScript knowledge, but it sounds like you want to ask each group if it contains any subgroups, then gather info on them as appropriate.
 
OK, if I have to put "as list" in that line, why don't I have to also put it in the line:
set group_list to every group --gets top-level groups only
??
Seems rather arbitrary and inconsistent.
 
The canvas object has a list called groups
but the sub-group list of any group is just group (no final s)

You could get a list of grouped objects by referring, for example to:
Code:
group of item 1 of group of group 1 of canvas 1 of document 1
--
 
OK, now my head hurts.

According to OG's scripting dictionary, "canvas" contains "groups" (plural). Also, "group" contains "groups" (plural). So if I get every group in a group, shouldn't it automatically return a list of them? Isn't that what "every" means? Why can I get a list of every (top level) group in a canvas, but not in a group?

What am I missing?
 
Quote:
Originally Posted by RobLewis View Post
According to OG's scripting dictionary ... "group" contains "groups" (plural)
Not as far as I can see ... (OG Pro 5.1.1)

A group appears to consist of a list of graphic objects, each of which has a group (a list, which may be empty, of further graphic objects).

Have you tried taking a look through Script Debugger's Explorer ?

--

Last edited by RobTrew; 2009-08-25 at 11:46 PM..
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing .graffle files into a .graffle document gshenaut OmniGraffle General 0 2013-03-20 05:09 PM
Graffle shrinking pandrus OmniGraffle General 0 2012-02-21 10:25 AM
Gliffy to Graffle? Any way possible? markfrancombe OmniGraffle General 0 2011-01-10 07:29 AM
outliner to graffle korczowski OmniGraffle General 1 2008-07-11 02:01 PM
Omni Graffle, and new Macbook Pro ericc2222 OmniGraffle General 1 2006-11-27 01:20 PM


All times are GMT -8. The time now is 02:13 PM.


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