The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle Extras (http://forums.omnigroup.com/forumdisplay.php?f=7)
-   -   Applescript and groups (http://forums.omnigroup.com/showthread.php?t=20026)

cyleigh 2011-02-06 02:54 PM

Applescript and groups
 
I wish to traverse each group in my OG document. I have the following code:
[CODE]
tell application "OmniGraffle Professional 5"
set myGraphics to graphics of (canvas of front window)
repeat with g in myGraphics
set myGroup to group of g
if (myGroup is not missing value) then
repeat with g1 in graphics of myGroup
-- do some stuff
end repeat
end if
end repeat
end tell
[/CODE]

I get the result that "myGroup" is not defined; I thought the whole point of testing for missing value is to check for defined? (ie/ null check). The if statement doesn't work the other way either (ie, check for missing value).. what am I doing wrong?

whpalmer4 2011-02-06 05:09 PM

Yeah, that doesn't quite do what you want. Here's an example that works better:

[code]
tell application "OmniGraffle Professional 5"
set allGroups to every graphic of (canvas of front window) whose class is group
repeat with _group in allGroups
repeat with _graphic in graphics of _group
set draws shadow of _graphic to false -- turn off shadow for grouped objects
end repeat
end repeat
end tell

[/code]

Some of these things are challenging to figure out without using something like the Explorer in Script Debugger...

cyleigh 2011-02-07 04:00 PM

Thanks. Script Debugger is very helpful, now to convince the powers to be to spend money on it!


All times are GMT -8. The time now is 08:00 PM.

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