|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Setting Jump targets via AppleScriptHello,
I am trying to use AppleScript to create a Table of Contents page for my OG documents. I think conceptually I've got a pretty good idea of how to do it; loop through all the canvases, create a shape whose text is the canvas title + page number, and then, I'd like to create a jump target to that particular canvas. 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. Is this a known issue? is there a workaround? Here's my simple code, FWIW: tell application "OmniGraffle Professional 5" set theHeight to 14.0 set theCanvases to every canvas of the first document tell canvas of front window repeat with theCanvas in theCanvases set theTitle to the name of theCanvas set thePage to ((the id of theCanvas)) make new shape at end of graphics with properties {fill:no fill, draws shadow:false, jump:theCanvas, size:{86.0, theHeight}, side padding:0, autosizing:full, vertical padding:0, origin:{140.0, 175.0 + theHeight * thePage}, text:{text:theTitle, alignment:center}, draws stroke:false} make new shape at end of graphics with properties {fill:no fill, draws shadow:false, jump:theCanvas, 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:center}, draws stroke:false} end repeat end tell end tell _______________________________________________ OmniGraffle-Users mailing list OmniGraffle-Users@... http://www.omnigroup.com/mailman/listinfo/omnigraffle-users |
|
|
Re: Setting Jump targets via AppleScript>
> 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 :) _______________________________________________ OmniGraffle-Users mailing list OmniGraffle-Users@... http://www.omnigroup.com/mailman/listinfo/omnigraffle-users |
|
|
Re: Setting Jump targets via AppleScriptHi Joshua,
Thanks for the script. It did not work on our documents as we have shifted the pages around so the canvas ID's were not working. I made some changes to the script and added a few features, like a multicolumn set up and configuration. Find it here: http://unitid.nl/2010/07/creating-a-table-of-contents-in-omnigraffle-with-applescript/ |
| Free embeddable forum powered by Nabble | Forum Help |