An AppleScript to append the containing folder for each selected record to the existing tag set – “container-to-tag”:
tell application “EagleFiler”
[INDENT]set _records to selected records of browser window 1
repeat with _record in _records
[INDENT]if _record’s container’s name is not “Files” then
[INDENT]set _record’s assigned tag names to (_record’s assigned tag names & _record’s container’s name)
end if[/INDENT]
end repeat[/INDENT]
end tell[/INDENT]
An elaborated version that appends the complete hierarchy of containing folders – “container-hierarchy-to-tags”:
tell application “EagleFiler”
[INDENT]set _records to selected records of browser window 1
repeat with _record in _records
[INDENT]get name of _record
set _container to container of _record
set _containerName to _container’s name
repeat until _containerName is “Files”
[INDENT]set _record’s assigned tag names to (_record’s assigned tag names & _containerName)
set _container to container of _container
set _containerName to _container’s name
end repeat[/INDENT]
end repeat[/INDENT]
end tell[/INDENT]
Suggested workflow:
- Run script.
- Move records to higher level (highest if running on all records).
- If all records from containing folders have been so moved, trash containing folder(s).
Usage notes:
- [NTIM] Folders are assigned tags.
- [IIMAD] Subfolders with identical names in different folders will be given identical tags.
- [FYI] Spaces in folder names are converted to underscores.