Tinderbox Explode uses regex, without escaping ^^^
as \^\^\^
it won’t work.
DEVONthink has no built-in explode command but this is a perfect case for AppleScript's text item delimiters
.
This script creates new records (and a version of the source record without delimiters). Don’t know how you’ve set your delimiters so maybe you have to change theDelimiter
.
Edit: This script handles only plain text - if you want to split RTF(D) text use this instead.
-- Explode text into new text records (and create version of source text without delimiters)
property theDelimiter : linefeed & linefeed & "^^^" & linefeed & linefeed
tell application id "DNtp"
try
set windowClass to class of window 1
if {viewer window, search window} contains windowClass then
set currentRecord_s to selection of window 1
else if windowClass = document window then
set currentRecord_s to content record of window 1 as list
end if
set theRecord to item 1 of currentRecord_s
set theText to plain text of theRecord
set d to AppleScript's text item delimiters
set AppleScript's text item delimiters to theDelimiter
set TextItems to text items of theText
set AppleScript's text item delimiters to d -- always set them back
set theGroup to (parent 1 of theRecord)
repeat with thisTextItem in TextItems
repeat with thisParagraph in (paragraphs of thisTextItem)
if thisParagraph ≠ "" then
set theName to thisParagraph
end if
exit repeat
end repeat
set thisRecord to create record with {name:theName, plain text:thisTextItem, type:text} in theGroup
end repeat
set theTextWithoutDelimiters to my string_From_List(TextItems, linefeed)
set recordWithoutDelimiters to create record with {name:(name of theRecord & " (without Delimiters)"), plain text:theTextWithoutDelimiters, type:text} in theGroup
on error error_message number error_number
if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
return
end try
end tell
on string_From_List(theList, theDelimiter)
set theString to ""
set theCount to 0
repeat with thisItem in theList
set theCount to theCount + 1
set thisItem to thisItem as string
if theCount ≠ (count of theList) then
set theString to theString & thisItem & theDelimiter
else
set theString to theString & thisItem
end if
end repeat
return theString
end string_From_List