Script to "hide" selected records

EDIT: Here’s an updated version which adds EagleFiler notes to the Spotlight Comments.

This script deletes EagleFiler records, while leaving the associated files in place. This process effectively hides the files from EagleFiler. OpenMeta tags assigned to the files in EagleFiler are preserved, and EF notes are added to Spotlight Comments “Hidden” files can be imported anew into EF, but they must first be moved out of the EF folder to another location. Most of the script is from Michael’s “Duplicate Records” script](http://c-command.com/scripts/eaglefiler/duplicate-records). Thanks, Michael!

-Steve

(* Hide Selected Records from EagleFiler
Version 2
This script deletes records from the EagleFiler library but keeps the copies of the files in place.
OpenMeta tags applied in EF are transferred, and EF notes are added to Spotlight Comments.
The script is based on  "Duplicate Records"  by Michael Tsai (http://c-command.com/scripts/eaglefiler/duplicate-records).
Change from Original Version: Notes added to Spotlight Comments
*)
tell application "EagleFiler"
	set theSelection to selected records of browser window 1
	set _trash to trash of document of browser window 1
	
	tell library document 1
		repeat with theTemplate in theSelection
			set _container to theTemplate's container
			set _loc to _container's file
			set _home to POSIX path of _loc
			set theFile to theTemplate's file
			
			-- Add  notes, if any, to Spotlight Comments
			if has note of theTemplate is true then
				set _ntext to note text of theTemplate as text
				tell application "Finder"
--   Invisible new line characters  
  end the next two lines  --
					set the comment of file theFile to _ntext & "
" & "
" & the comment of file theFile
				end tell
			end if
			
			set thePath to POSIX path of theFile
			set theName to do shell script "basename " & thePath's quoted form
			set tempFolder to do shell script "mktemp -d -t 'Temp'"
			set tempPath to tempFolder & "/" & theName
			do shell script "cp -Rp " & thePath's quoted form & " " & tempPath's quoted form
			set the theTemplate's container to _trash
			do shell script "cp -Rp " & tempPath's quoted form & " " & _home's quoted form
		end repeat
	end tell
end tell

Thanks for the script. I think people will find it useful. The way I would describe it is that it deletes the EagleFiler records while leaving the files in place. That is, you aren’t telling EagleFiler to hide the files; rather, you are hiding them from EagleFiler. Just to be clear.

Since (assuming you empty the trash) the files are no longer in EagleFiler, there are no EagleFiler notes or tags on them. There would probably still be OpenMeta tags on the files in the Finder, though.

Thanks, Michael. I’ll rephrase the description. I checked that OpenMeta tags are preserved.
-Steve

New Version adds EF Notes to Spotlight Comments
I replaced the original script in the first post with one which adds EagleFiler notes to the Spotlight Comments.
-Steve