If we copy and paste OmniOutliner rows into a fresh new document, their topics and notes are carried across but (unless the column structure has been duplicated) any user-defined column data is left behind.
Here is a script which makes a new document containing:
Any user-defined column data for the selected rows is transferred across, including choice lists for popup columns.
(Once the column structure has been duplicated in this way, additional rows can simply be copied and pasted across, and will preserve their column data).
(I tend to use this in combination with another script which automatically selects any rows matching a set of user-specified criteria)
Here is a script which makes a new document containing:
- All of the columns of the front document,
- any rows selected in the front document.
Any user-defined column data for the selected rows is transferred across, including choice lists for popup columns.
(Once the column structure has been duplicated in this way, additional rows can simply be copied and pasted across, and will preserve their column data).
(I tend to use this in combination with another script which automatically selects any rows matching a set of user-specified criteria)
Code:
-- Make a new document containing all columns, and any selected rows, of the current document -- Ver 0.3 RobTrew property pNewDocTitle : "NEW DOC FROM SELECTED ROWS" -- MAKE A NEW DOCUMENT CONTAINING: -- 1. ALL THE COLUMNS OF THE FRONT DOCUMENT -- 2. ANY ROWS SELECTED IN THE FRONT DOCUMENT tell application "OmniOutliner Professional" set oDoc to front document set docNew to make new document with properties {name:pNewDocTitle} set width of topic column of docNew to width of topic column of oDoc -- COPY ADDITIONAL COLUMNS FROM ORIGINAL DOCUMENT repeat with iCol from 3 to count of columns of oDoc set oCol to column iCol of oDoc tell oCol set {varName, varType, varWidth} to {name, type, width} end tell tell docNew set oNewCol to make new column with properties {name:varName, type:varType, width:varWidth} if varType is popup then set refEnums to (a reference to enumerations of oCol) duplicate refEnums to end of enumerations of oNewCol end if end tell end repeat -- COPY ANY SELECTED ROWS INTO THE NEW DOCUMENT set refSeldRows to a reference to selected rows of oDoc set lstSeldRows to contents of refSeldRows if length of lstSeldRows > 0 then duplicate refSeldRows to the end of the children of docNew set expanded of rows of docNew to false activate end if end tell
Last edited by RobTrew; 2010-06-07 at 04:18 AM.. Reason: Copied rows automatically collapsed