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
If I remove the
try ... end try 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 ?