The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   Using AppleScript to set the Script field of a shape (http://forums.omnigroup.com/showthread.php?t=21723)

MiBo 2011-07-26 01:51 PM

Using AppleScript to set the Script field of a shape
 
I'm using OmniGraffle 2.2 and it does almost everything I need from within AppleScript except for one thing. If that one things exists in the most recent version of OmniGraffle then it will be worth it for me to upgrade. However, since I don't have the current version to search for the answer, I wonder if someone here can tell me if it is possible.

From within an AppleScript script, I would like to be able to set the script field of a shape. Is this possible? Here is an example code fragment:

set aShape to make new shape at end of graphics with properties {fill color:{51657, 52942, 65535}, origin:{28, 450}, size:{28, 500}, draws shadow:false, thickness:1, draws stroke:true, script:"myscript"}

except that "myscript" would contain the AppleScript code that would get executed when this shape is selected while in Browse mode.

This function does not appear to work in version 2.2

Thanks,

Mike

john.gersh 2011-07-27 04:45 AM

You can certainly do that in the current version. The capability has been there for quite a while.

Your example with a real script in it works as expected in 5.3:

[CODE]
tell application "OmniGraffle Professional 5"
tell canvas of front window
set aShape to make new shape at end of graphics with properties {fill color:{51657, 52942, 65535}, origin:{28, 450}, size:{28, 500}, draws shadow:false, thickness:1, draws stroke:true, script:"set the text of self to \"foo\""}
end tell
end tell

[/CODE]

MiBo 2011-07-27 10:21 AM

Thanks for the reply. Now I get to try the App Store for the first time!

Mike


All times are GMT -8. The time now is 01:08 AM.

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