The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   Automating OO3 --> OG outline diagramming (http://forums.omnigroup.com/showthread.php?t=7764)

RobTrew 2008-04-12 03:33 AM

Automating OO3 --> OG outline diagramming
 
I like to frequently diagram an outline argument that I am drafting in Omnioutliner.

So far, the Applescript that I am using to make an OG diagram from the currently selected 003 lines looks like this:

[CODE](* This assumes that some rows are selected in OmniOutliner *)

on run

-- SAVE A FRESH OO3 DOC USING JUST THE SELECTED LINES

tell application "OmniOutliner Professional"
set MyDoc to front document


set FirstRowID to id of first selected row of MyDoc
set FirstRow to a reference to row id FirstRowID of MyDoc
set MyRowIDs to id of every selected row of MyDoc

set oNewDoc to make new document
set oNewFirst to make new row at end of oNewDoc

repeat with MyRowIndex from 1 to count of MyRowIDs -- force forward loop
set MyRowID to item MyRowIndex of MyRowIDs
duplicate row id MyRowID of MyDoc to before oNewFirst
end repeat
delete last row of oNewDoc

set FilePath to (POSIX path of (path to desktop) as string) & "foobar2.oo3" as POSIX file
save oNewDoc in FilePath
close oNewDoc
end tell

-- IMPORT THE SAVED DOCUMENT INTO OMNIGRAFFLE

-- Assumes following settings
---- View>Page_Breaks :OFF
---- View>Zoom>Fit in Window
--In Canavas Size inspector:
---- Size is multiple of printer sheets OFF
----Auto-adjust the canvas size ON
----Print canvas on one printer sheet ON

tell application "OmniGraffle Professional 5"
activate
set strPath to POSIX path of FilePath as string
try
set oDoc to import strPath
end try
end tell
end run
[/CODE]

If I remove the [B][I]try ... end try[/I] [/B] from the closing lines, however, I get a puzzling error message about the impossibility of converting the OG application into a reference ...

This syntax glitch (bug?) is annoying as I would like to extend the script to automatically use a particular style-sheet. Any thoughts ?


All times are GMT -8. The time now is 10:42 AM.

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