The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle Extras (http://forums.omnigroup.com/forumdisplay.php?f=7)
-   -   Using Omnigraffle for interactive prototypes - need Applescript help (http://forums.omnigroup.com/showthread.php?t=20173)

Steveo 2011-02-17 09:21 AM

Using Omnigraffle for interactive prototypes - need Applescript help
 
Applescript isn't very well documented in OG and I'm having difficulty with some basic issues. The first issue, is how to address a graphic object.

The script below is supposed to modify a graphic object with the tag 'object_1' but it doesn't appear to work.

[CODE]tell application "OmniGraffle Professional 5"
tell canvas of front document
set targetGraphic to first graphic whose tag contains "object_1"
set text of targetGraphic to {text:"differenttext", color:{1.0, 1.0, 1.0}, alignment:center}
end tell
end tell[/CODE]

More broadly, the things I'm trying to do are:[LIST][*]Simulate typing into a text box[*] Animate a dialog appearing/disappearing[*] Animate an object after clicking on a different object (slider control)[*] Fade graphics in and out[/LIST]
To do all this, my first hurdle is simply addressing objects

thanks,
-steve

whpalmer4 2011-02-17 12:06 PM

A few issues:

you're specifying a color for the text which will be invisible unless you've set the background color to something else

while it may seem like first graphic whose tag is "xyz" ought to give you a single item, it gives you a list of length 1. If you take the first item from the list, you should be able to manipulate it as you want. You'll also want to watch out for graphics whose class is not shape; groups in particular won't allow you to set their text.

Script Debugger is a big help when trying to puzzle this stuff out.


All times are GMT -8. The time now is 02:51 AM.

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