Applescript? (OmniGraffle 2.0 Beta v7 Now Available)
Greg Titus
greg at omnigroup.com
Thu Jan 31 13:44:02 PST 2002
On Thursday, January 31, 2002, at 10:49 AM, Bruce D'Arcus wrote:
>
> I know enough about Applescript to have a sense that this new
> functionality
> could be very useful, but not enough to know *how.* Can someone
> enlighten
> me?
Basically AppleScript can perform any combination of actions on a
document that you can (if we've provided all of that functionality in
the AppleScript dictionary -- right now we're close, but it's not 100%).
AppleScript is great for automating repetitive tasks and for integrating
separate applications and making them work together.
> On 1/31/02 10:53 AM, "manny at omnigroup.com" <manny at omnigroup.com> wrote:
>> - More AppleScript support
>> - AppleScripts can be configured on the toolbar, complete with
>> custom icons.
If you make a Library/Application Support/OmniGraffle/Scripts folder and
place compiled AppleScripts in that folder, then when you customize the
toolbar in OmniGraffle, those scripts will show up in the configure list
and you can drag them onto the toolbar and easily invoke them.
For the 2.0 final (probably for the next beta if there is one) we will
also have a Scripts menu with these scripts as well. At the moment it
looks like it is impossible for a Cocoa app to have a "real"
Carbon-style scripts menu (with a script icon in the menu bar) but we'll
see. (It's a known bug that has been reported to Apple.)
>> - AppleScripts can be attached to individual graphics.
There's a little AppleScript editor embedded in OmniGraffle now, on the
Link Info panel. You can select a graphic and write AppleScript in this
editor to attach a script to the shape.
Turn on "Show Links" in the Format menu and little script icons appear
on the shapes with AppleScripts and little URL 'zaps' appear on shapes
with web links. You can click these icons to open the appropriate web
page or run the appropriate script. Alternatively, there is now a
"Browse Links" drawing mode. Your cursor changes to the "hand" and
shapes with active content will highlight as you move over them.
One potential use for the links is for drawing maps of web sites or
other types of documents. (If you use OmniGraffle's framework or
ProjectBuilder project import features, you'll notice that all of the
boxes are now linked to the original file that the class came from, so
you can go into browse mode and quickly open up class files you are
interested in.)
One thing I like to use the script attachment feature for is for keeping
track of my workflow when it gets a bit more chaotic than a nice
hierarchical list like OmniOutliner handles. I draw a bunch of lines and
boxes and attach a simple 'set fill color to "green"' script on the
boxes and leave the document in the corner of the screen in browse mode.
As I finish a task and click on each shape, it fills in green. (Note to
AppleScripters: the attached scripts are implicitly targetted at
whatever graphic they are attached to, so there is no need to write a
tell block for simple scripts like this.)
You could, of course, get quite a bit more complicated with these
scripts. I have a fun example of a "Simulate" button with a fairly long
attached script that you can just paste onto a Graffle document that
contains components from the new Boolean Gates palette. Click "Simulate"
and the wires and gates start animating turning red and black to
represent on and off states as appropriate. (Anyone remember that old
Apple II educational game "Rocky's Boots?")
>> - "Edit->Copy As->AppleScript" copies the current selection as
>> AppleScript source.
A very easy and quick way to construct an AppleScript which interacts
with Graffle is to select one or more shapes in Graffle, choose Copy As
AppleScript, and paste into a script editor. You'll get valid
AppleScript to recreate copies of the selected shapes, and you can
customize your script from there.
We plan on including some example scripts with 2.0 final to do some cool
things and show off some of the possibilities.
--Greg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 4193 bytes
Desc: not available
Url : /mailman/archive/omnigraffle-users/attachments/20020131/adb61931/attachment.bin
More information about the OmniGraffle-Users
mailing list