Triggering on File Tags

I am looking for a while to execute a trigger while a file appears in a folder with a specific tag on it. What options do I have for this?

The word "tag" could mean different things. Are you talking about the coloured tag that appears in macOS Finder?

There might be a solution to this, I just haven't figured out what it is yet.

Does your Mac have a package manger installed? Eg, MacPorts, HomeBrew?

We may need to install this package: (because I can't spot tag support directly in KM)

Odds are that one of the wizards on this site will be able to achieve your goal with AppleScript in KM, but I'm not very skilled in that topic yet.

I'm not sure I understand your request, but if you want a KM Macro that will be triggered whenever a file is put into a folder, and if that file has a certain Finder Tag, then perform some process, then something like this should do it:

Example Output



MACRO:   Process Files with Certain Tag that are Put (Dropped) in Folder [Example]

**Requires: KM 9+   macOS 10.11 (El Capitan)+**
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

#### DOWNLOAD Macro File:
<a class="attachment" href="/uploads/default/original/3X/6/5/654c572b951f516c79997827c41693ce31c578cb.kmmacros">Process Files with Certain Tag that are Put (Dropped) in Folder [Example].kmmacros</a>
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**


### ReleaseNotes



* **Process Files with Certain Tag Dropped in Folder**
   * You will need to ADD Actions for your Process


1. First, make sure you have followed instructions in the _Macro Setup_ below.
2. Change the Macro Trigger to the Folder you want to use
3. Drop a File with the required Tag onto this folder to Trigger this macro.


* **Carefully review the Release Notes and the Macro Actions**
  * Make sure you understand what the Macro will do.  
  * You are responsible for running the Macro, not me.  ??
**Make These Changes to this Macro**
1. Set the Folder for the Folder Trigger
2. Move this macro to a Macro Group that is only Active when you need this Macro.
3. ENABLE this Macro, and the Macro Group it is in.
(all shown in the magenta color)
   * Set Variable “Local__TagToProcess”  
     * change to Tag you want to use
   * ADD Your Actions Below the Comment 


1. **KM 9.0+** (may work in KM 8.2+ in some cases)
2. **macOS 10.11.6 (El Capitan)+**

TAGS:  @Trigger @Folder @Tags


* Any Action in _magenta color_ is designed to be changed by end-user


* To facilitate the reading, customizing, and maintenance of this macro,
      key Actions are colored as follows:
* GREEN   -- Key Comments designed to highlight main sections of macro
* MAGENTA -- Actions designed to be customized by user
* YELLOW  -- Primary Actions (usually the main purpose of the macro)
* ORANGE  -- Actions that permanently destroy Variables or Clipboards,
OR IF/THEN and PAUSE Actions


* While I have given this a modest amount of testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
* If you have any doubts or questions:
  * **Ask first**
  * Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.


<img src="/uploads/default/original/3X/c/e/cea828e4eaaa98850c86e7e26cf02a181c060cca.png" width="523" height="977">

Wow, I've never even seen the "Get File Attribute" action. Am I fired? My idea about downloading a tag program is therefore unneeded. Had I known about that action I probably would have written exactly what you wrote in your macro. Although you provide some fancy-schmancy documentation and techniques (and colours) that I usually don't include. :wink: