Well-behaved applescript libraries return
missing value in such cases.
There is, however, a fairly major bug in the OmniGraffle library which is worth reporting through OmniGraffle
Help > Send Feedback ..., because it imposes burdens which other applescript libraries do not: a lot of logic has to be 'Rube Goldberged' rather inefficiently and clumsily with verbose error-handling routines, or indirect property access, in lieu of simple control structures and assignments.
A number of properties (e.g. Shape properties like
group, jump, notes, rank group, script, shadow color, shadow vector, stroke color, tag, url, user data) simply fail to return a value at all when they should return
missing value.
The fact that this is a bug rather than a design decision becomes clear if you access these same properties indirectly through the object's
properties collection. Reached circuitously through this interface they behave correctly.
It looks like some basic and architectural misapprehension may have arisen when the OG applescript library was written ...
Sample snippets:
Code:
tell application id "OGfl"
tell front window
set lstShapes to selection
if length of lstShapes < 1 then return
set oShape to first item of lstShapes
-- Rube Goldberg: error handling ... should not be necessary
try
set oGroup to group of oShape
on error
set oGroup to missing value
end try
-- Indirect access, through properties record.
-- it works, even when there is no group, but should NOT be necessary
set recProps to (properties of oShape) as record
set oGroup to group of recProps
if oGroup is not missing value then
set strID to id of oGroup
-- Filtering: requires plural "groups"
set lstGroup to groups of front canvas where its id is strID
end if
end tell
end tell