The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle Extras (http://forums.omnigroup.com/forumdisplay.php?f=7)
-   -   How do I iterate over ALL shapes in a canvas? (http://forums.omnigroup.com/showthread.php?t=4318)

supertwang@yahoo.com 2007-07-26 04:51 PM

(AppleScript) How do I iterate over ALL shapes in a canvas?
 
I'm trying:
[INDENT] tell application "OmniGraffle Professional 4"
[INDENT]tell canvas of front window
[INDENT]repeat with obj in graphics
[INDENT] blah blah do something
[/INDENT] end repeat[/INDENT] end tell[/INDENT] end tell[/INDENT]
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


All times are GMT -8. The time now is 11:10 AM.

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