Re: Setting Jump targets via AppleScript
joshua dickens <[email protected]>
| Newsgroups | gmane.comp.graphics.omnigraffle.user |
|---|---|
| Message-ID | <[email protected]> |
>
> The problem is, setting a jump target via applescript doesn't seem to work
> -- when the text is created the inspector still says "Do nothing", and using
> the action browse tool doesn't indicate any clickability. In fact, if I
> copy the item again via applescript, it doesn't show the properties.
Well, my lack of AppleScript knowledge might have been the cause -- I was
able to solve the problem by explicitly using "*set* jump *of* lastShape *to
* theCanvas" (instead of simply passing it in through the hash):
*tell* *application* "OmniGraffle Professional 5"
*set* theHeight *to* 14.0
*set* theCanvases *to* *every* *canvas* *of* *the* *first* *document*
*tell* *the* *first* *document*
*set* myCanvas *to* (*make* new *canvas*)
*repeat* *with* theCanvas *in* theCanvases
*if* (theCanvas *is* *not* myCanvas) *then*
*set* theTitle *to* *the* name *of* theCanvas
*set* thePage *to* ((*the* id *of* theCanvas) - 1)
*tell* myCanvas
*set* lastShape *to* *make* new *shape* at *end* *of* *graphics* with
properties {fill:no fill, draws shadow:false, size:{86.0, theHeight}, side
padding:0, autosizing:full, vertical padding:0, origin:{140.0, 175.0 +
theHeight * thePage}, *text*:{*text*:theTitle, alignment:left}, draws stroke
:false}
*set* jump *of* lastShape *to* theCanvas
*set* lastPageShape *to* *make* new *shape* at *end* *of* *graphics* with
properties {fill:no fill, draws shadow:false, size:{43.0, 14.0}, side
padding:0, autosizing:full, vertical padding:0, origin:{85.0, 175.0 +
theHeight * thePage}, *text*:{*text*:thePage *as* *string*, alignment:right},
draws stroke:false}
*set* jump *of* lastPageShape *to* theCanvas
*end* *tell*
*end* *if*
*end* *repeat*
*end* *tell*
*end* *tell*
So for anyone who needs it, there's a bare bones clickable table of contents
generator
for omnigraffle :)
---
Update: looks like OmniGraffle 5.2 creates a table of contents when you
export the whole document as a PDF! Nice! (still think my script should be
useful :)