If you attach a script triggered when you add items to a folder you can't use an other script to be triggered when you remove items.
Maybe - I never tried - you may have the two handlers in the same script.
Here is a script using an other scheme.
It must be saved as a stay open application.
Every ten seconds it will poll the defined items.
What is fine is that we just have to define the alias to treat. The script will grab the path to the original items by itself.
I must thank's Shane STANLEY which gave me the correct syntax required to to that with ASObjC.
##################################
# on idle.app
# This script MUST be saved as a stay open application
# In real life put it in the list of files to launch on boot.
# to try, just double click its icon
##################################
use AppleScript version "2.4" # Yosemite or higher
use framework "Foundation"
use scripting additions
#=====
on run
--
end run
#=====
on idle
set |⌘| to current application
set p2d to path to desktop as text
set theAliases to {"my alias", "tempo"} #<<<<<<<<<<<<<<<<<<<<<<< Edit to fit your needs
repeat with theAlias in theAliases
set aliasURL to (|⌘|'s class "NSURL"'s fileURLWithPath:(POSIX path of (p2d & theAlias)))
set {originalURL, theError} to (|⌘|'s class "NSURL"'s URLByResolvingAliasFileAtURL:aliasURL options:0 |error|:(reference)) # Thank's to Shane STANLEY
set fileManager to |⌘|'s NSFileManager's defaultManager()
set theFiles to (fileManager's contentsOfDirectoryAtURL:originalURL includingPropertiesForKeys:{} options:(|⌘|'s NSDirectoryEnumerationSkipsHiddenFiles) |error|:(missing value))
set nbItems to 1 + (count theFiles)
--set tagNames to (current application's NSWorkspace's sharedWorkspace()'s fileLabels()) as list
--> {"Aucun", "Gris", "Vert", "Violet", "Bleu", "Jaune", "Rouge", "Orange"}
set thisLocale to |⌘|'s NSLocale's currentLocale()
if (thisLocale's countryCode as text) is not "FR" then
# Try with a non-standard list matching Robert's wishes
set tagNames to {"None", "Orange", "Red", "Yellow", "Blue", "Purple", "Green", "Gray"}
else
# Define the same list in French
set tagNames to {"Aucun", "Orange", "Rouge", "Jaune", "Bleu", "Violet", "Vert", "Gris"}
end if
if nbItems > (count tagNames) then set nbItems to (count tagNames)
set theTag to item nbItems of tagNames
(my setTags:{theTag} forItem:originalURL)
(my setTags:{theTag} forItem:aliasURL)
end repeat
return 10 # period of 10 seconds. You may use 5 seconds #<<<<<<<<<<<<<<<<<<<<<<< Edit to fit your needs
end idle
# Customisedd version of a handler borrowed to Shane STANLEY
-- Replace tags; pass a list of the new tags plus an URL
on setTags:tagList forItem:thisURL
set {theResult, theError} to thisURL's setResourceValue:tagList forKey:(current application's NSURLTagNamesKey) |error|:(reference)
if theResult as boolean is false then error (theError's |localizedDescription|() as text)
end setTags:forItem:
#=====
on quit
continue quit
end quit
#=====