PDA

View Full Version : How do I iterate over ALL shapes in a canvas?


supertwang@yahoo.com
2007-07-26, 04:51 PM
I'm trying:

tell application "OmniGraffle Professional 4"
tell canvas of front window
repeat with obj in graphics

blah blah do something

end repeat
end tell
end tell

but am finding that objects disappear from the graphics list when they have been grouped. I'm not good enough at Applescript or Omnigraffle to figure out how to dive into all of the groups. Can anyone help me?

A lot of the scripts from the community I am reading use

repeat with obj in selection

but I am trying to find items that I've previously drawn via AppleScript (in order to connect them later with lines). Sure wish Applescript had an associative dictionary, but, I'm looking for a brute-force search for an item that I've tagged with a string, to suffice.

Thanks for any help anyone can provide in deep-iterating over all of the shapes in a canvas (grouped or ungrouped).

Dave

ChristianS
2007-08-20, 09:59 AM
Hi,
try this and you get a list of lists of graphics
tell application "OmniGraffle Professional"
tell canvas of front window
groups's graphics
end tell
end tell

Best Regards