Merging text note titles into a single document

I just imported all of my OmniOutliner files into DT Pro Office, and most of the items were converted to text notes with titles only. Is it possible to select a bunch of text notes with titles only and merge those titles into one text note? I tried to merge them but I am guessing it only works if there is content within the text notes?


This AppleScript worked for me with some casual testing. (I feel like there should be an easier way to do some of these steps, but my AppleScript-fu is fairly weak)

Beware: It will grab the titles of every document you select and set the contents of the first file you select to the titles… so be careful with this.

tell application "DEVONthink Pro"
	set theSelection to the selection
	set theTitles to {}
	repeat with thisSelection in theSelection
		set theTitles to theTitles & the name of thisSelection
	end repeat
	set oldDelimiters to AppleScript's text item delimiters
	set AppleScript's text item delimiters to (ASCII character 10)
	set theDocumentContent to theTitles as string
	set AppleScript's text item delimiters to oldDelimiters
	set the plain text of (item 1 of theSelection) to theDocumentContent
end tell

Let me know if that works for you.

@CaptainCowpie, it sounds like you might have exported your OO3 documents as OPML and then imported those to DTPO? What you described is the result of importing an OPML – DEVONthink splits every outline item into separate groups and documents.

Simpler than trying to fix this with a script is to go back to OO3 and export using some other format. RTF or Word, and so on. IOW, let OO3 fix the problem for you rather than trying to write code.


Thanks for the suggestion. I tried to export a document in all of the formats, and it imports it as one large file, with all of the indentations intact. I liked how DTPO converted everything into groups on OPML import, but on a lot of the items I would like the lowest level (those converted to individual text files) to be one text file instead of individual items. It makes sense how DTPO does it, but I just needed a different format.

NDouglas, I appreciate you taking the time to write a script for me. I am going to put some items in a test file and try it out. I am looking forward to see how it works.

Thanks for the help on this. I will report back when I have converted some of the files.


Then you might find this useful in addition to @ndouglas’ suggestion:

[url]Exporting/Printing with Names]

NDouglas and Korm, thanks for the help on this, I really appreciate it. I tried both scripts, and they both work great! I was able to combine a bunch of single text documents into one in many of the data sets that I imported from OmniOutliner.

It took me a little while because I hadn’t used AppleScript for some time and had to brush up on how to use it.

Thanks again for all of the help.