The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniOutliner > OmniOutliner 3 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Merge Children to notes field Thread Tools Search this Thread Display Modes
Hy Friends,

I'm struggling with AppleScript and OmniOutliner.
I'd like to export my Outline as .opml for Scrivener (http://www.literatureandlatte.com/scrivener.php).

Unfortunately in Scrivener only the Text in notes-field comes in as Text, all the children are imported as sub-topics.

Long story short:
I need an applescript that moves all of the children of the selected row into it's notes field.

So that:
- Topic
- 1
- 2
- 3

becomes

- Topic
1
2
3
with the lines 1,2 and the 3 in the notes field. Preferably without the dashes :-)

This applescript here (http://muninn.net/blog/2010/03/omnio...cted-rows.html) can copy the clipboard to the notes.

I also found a Applescript for merging children:
http://forums.omnigroup.com/showthre...ighlight=merge

Can anyone pleas help me with this applescript idea? :-)
 
What happens if the children have notes, or children of their own?
 
OO3 → Markdown → Scrivener > File > Import MultiMarkdown

may prove to be a shorter route than:

OO3 → Applescript → OPML → Scrivener > File > Open OPML

One route to the Markdown would be the MMD exporter for OO3

(http://forums.omnigroup.com/showthread.php?t=7625)

http://fletcherpenney.net/2011/10/omnioutliner_plugin

(FoldingText outlines will also import directly through the MMD importer, but you may not want the tab indentations).

--

Last edited by RobTrew; 2012-10-31 at 09:10 AM..
 
Quote:
Originally Posted by whpalmer4 View Post
What happens if the children have notes, or children of their own?
Excellent question.
Now that I thought about it: merging everything to normal paragraphs - without indent - would be perfect for my needs.
 
Quote:
Originally Posted by RobTrew View Post
OO3 → Markdown → Scrivener > File > Import MultiMarkdown
--
Thanks. Got the Markdown export working.
Unfortunately I get the same result as with OPML.

Which seems logical, because Scrivener can't know at which hierachy I want the outline to stop and the "normal Text" to start.
Hope this makes sense to you too :D
 
I wonder if this script helps.

(Saves the front OO3 document as flattened text).

You can adjust the value of the first few properties at the top of the script to tune things a little:

Code:
-- UNIT OF INDENT -- empty string in lieu of tab
property pstrIndentUnit : ""
property pstrDefaultPrefix : "- "

-- EXPORT ONLY THE SELECTED OMNIOUTLINER 3 NODE AND ITS SUBTREE ?
property pblnSeln : false
This is currently prefixing each OO3 topic with a hyphen and space, and exporting the whole document rather than the selection and its subtree, but you could set the value of pstrDefaultPrefix to an empty string, and edit the value of pblnSeln to true, for example.

--
Attached Files
File Type: zip SaveAsFlatText-003.scpt.zip (51.5 KB, 769 views)

Last edited by RobTrew; 2012-11-02 at 03:10 PM..
 
PS the posted version of the script is exporting levels 1 and 2 of the OO3 outline as Markdown (hash-prefixed headers # and ##) but if you wanted to go down to using levels 3 or 4 (### and ####) of the OO3 hierarchy as headers you could adjust the value of:

Code:
property plngMaxHash : 2 -- Deepest level of OO3 nesting to flag as headers rather than bullets etc
 
Ver 3 (above) allows you to control the paragraph separator though the value of pstrEOL (end of line), now defaulting to two linefeeds. Also removes the hyphen prefix.
 
Hy Rob,

Thanks again for investing so much time in my issue.

Your script is really awesome. It's not what I need for my current issue, but I'm sure it will do me good at other projects - when I'm starting off with a neatly organized outline :-)

Unfortuantely my current outline isn't all that tidy :D
Being able to copy all of it's children without intend into the note field of the current selection would be perfect.
This way I can decide in OmniOutliner what will be the "last" folder in Scrivener and what will be normal Text.
 
Quote:
Originally Posted by viellieb View Post
Being able to copy all of it's children without intend into the note field of the current selection would be perfect.
Well you could experiment with this ...

(as drafted it doesn't delete the child nodes, but the comments contain instructions for changing the value of a property to do that, if it's really what you want, and if you are really working with a disposable copy of well backed up work). Personally I think that scripts are best used for gathering and integration, and deletion is always best done manually …

Code:
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
-- OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-- IF YOU *REALLY* WANT TO DELETE THE CHILD NOTES AFTER CAPTURING THEIR TEXT
-- CHANGE THE VALUE OF THIS PROPERTY TO TRUE …
-- BUT *ONLY* EXPERIMENT WITH DISPOSABLE COPIES OF MULTIPLY BACKED UP WORK ...
property pblnReallyDeleteDescendants : false

tell application id "OOut"
	set lstDocs to documents
	if length of lstDocs < 1 then return
	
	tell first item of lstDocs
		set lstSeln to selected rows
		if length of lstSeln < 1 then return
		tell first item of lstSeln
			if has subtopics then ¬
				set its note to its note & return & return & my GetSubText(its children)
			set its note expanded to true
		end tell
	end tell
end tell

on GetSubText(lstChiln)
	tell application id "OOut"
		set str to ""
		-- CAPTURE THE TEXT
		repeat with oChild in lstChiln
			tell oChild
				set str to str & its topic & return & return & its note & return & return
				if has subtopics of it then set str to str & my GetSubText(its children)
			end tell
		end repeat
		
		-- AND THEN DELETE THE CHILDREN ? 
		if pblnReallyDeleteDescendants then
			repeat with i from length of lstChiln to 1 by -1
				delete item i of lstChiln
			end repeat
		end if
		return str
	end tell
end GetSubText

Last edited by RobTrew; 2012-11-08 at 02:32 AM..
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Notes Field Grewal69 OmniFocus 1 for Mac 0 2013-02-08 10:02 PM
Bullets in Notes Field mctheriot OmniFocus 1 for Mac 3 2010-11-14 04:29 PM
Keep Notes field Expanded? Machineman OmniPlan General 4 2010-01-21 02:19 PM
Tabbing to Notes field Indivio OmniFocus 1 for Mac 4 2009-08-15 04:30 PM
CSV Export Notes Field Blatchara OmniFocus 1 for Mac 0 2007-12-21 10:09 AM


All times are GMT -8. The time now is 12:25 PM.


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