Guest
2012-03-19, 10:45 PM
An important limitation of the OmniGraffle scripting interface is that it doesn't know how to look inside groups, and doesn't know how to temporarily disassemble them either, so I think you would have to manually ungroup all your groups before your could read the properties of their components with Applescript.
Having done this, the following snippet illustrates some elements of how you might assemble a text listing of some of the properties of the shapes on a canvas, and place that listing in the clipboard.
Code:
-- Simple illustration of generating a text which lists
-- some of the properties of the shapes on an OmniGraffle canvas
on run
set {dlm, my text item delimiters} to {my text item delimiters, tab}
set strReport to ""
tell application id "OGfl"
tell canvas of front window
repeat with oShape in (shapes where its text ≠ "")
tell oShape
set {strFont, rSize, lstColor, eAligned} to ¬
{font, size, color, alignment} of ((properties of its text) as record)
set strReport to ((strReport & "
Text:" & tab & "\"" & its text & "\"
Posn:" & tab & origin as text) & "
Dimensions:" & tab & size as text) & "
Font:" & tab & strFont & "
Size:" & tab & rSize & "
Color:" & tab & lstColor & "
Alignment:" & tab & eAligned & "
"
end tell
end repeat
end tell
end tell
set my text item delimiters to dlm
set the clipboard to strReport
return strReport
end run
Last edited by RobTrew; 2012-03-20 at 04:38 AM..
Reason: adjusted code for simplicity