Tag Examples

Summary: Shows how to add and remove tags.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2011-09-23

Description

This script show how to add and remove a tag via AppleScript.

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

Script

tell application "EagleFiler"
    
set {_record} to selected records of browser window 1
    
    
-- add x
    
set _tagNames to _record's assigned tag names
    
set _record's assigned tag names to _tagNames & {"x"}
    
    
-- remove x
    
set _tags to _record's assigned tags
    
set _newTags to {}
    
repeat with _tag in _tags
        
if _tag's name is not "x" then
            
copy _tag to end of _newTags
        
end if
    
end repeat
    
set _record's assigned tags to _newTags
end tell