Tags From Spotlight Comments

Summary: Sets the tags of the selected records from the Spotlight comments.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2019-10-02

Description

If you’ve used the Finder to add tags to the Spotlight comments of a file, you can select the file in EagleFiler and run this script to set the EagleFiler tags accordingly.

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

Script

tell application "EagleFiler"
    
set theRecords to selected records of browser window 1
    
tell library document 1
        
repeat with theRecord in theRecords
            
set theFile to file of theRecord
            
tell application "Finder"
                
set theComment to comment of file theFile
            
end tell
            
set theTagNames to words of theComment
            
set theTags to {}
            
repeat with theName in theTagNames
                
copy tag theName to end of theTags
            
end repeat
            
set theRecord's assigned tags to theTags
        
end repeat
    
end tell
end tell