Merge Records

Summary: Create a new record with the text content of the selected records.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2020-01-21

Description

Select multiple records (in plain text, rich text, Word, or Web archive format) and invoke this script to create a new merged record (in rich text format) with all the text concatenated. The original records are moved to the trash. No tags or notes are transferred to the new record.

Installation Instructions · Download in Compiled Format · Download in Text Format

Script

tell application "EagleFiler"
    
set _tempFolder to POSIX path of (create temporary folder name "EFMergeRecords")
    
set _sepPath to _tempFolder & "/Sep.txt"
    
do shell script "echo > " & _sepPath's quoted form
    
set _records to selected records of browser window 1
    
tell library document 1
        
set _script to "/usr/bin/textutil -cat rtfd"
        
repeat with _record in _records
            
set _file to _record's file
            
set _path to POSIX path of _file
            
set _script to _script & " " & _path's quoted form
            
set _script to _script & " " & _sepPath's quoted form
        
end repeat
        
set _destName to "Merged " & basename of item 1 of _records & ".rtfd"
        
set _destPath to _tempFolder & "/" & _destName
        
set _script to _script & " -output " & _destPath's quoted form
        
do shell script _script
        
import files {_destPath}
        
repeat with _record in _records
            
set _record's container to trash
        
end repeat
    
end tell
end tell