To add tags files using Finder and a custom keyboard shortcut on a MacBook Pro (Intel) with macOS, follow these steps:
-
Configure Keyboard Shortcuts Settings:
- Open System Preferences by clicking on the Apple menu in the top left corner of your screen and selecting "System Preferences."
- Click on "Keyboard."
- In the Keyboard preferences window, click on the "Shortcuts" tab.
-
Create a New Service:
- Scroll down to the "Services" section.
- Click on the "+" button at the bottom of the list.
- In the "Add Service" dialog, set the following details:
- Service Name: Add Tags (Finder)
- Service Receiver: Finder
- Workflow File: Leave this field empty (we'll create a custom workflow later)
-
Assign a Keyboard Shortcut:
- Click on the "Keyboard Shortcut" field and press the desired keyboard combination (e.g.,
Command + T). - Click on "Add" to save the new service.
- Click on the "Keyboard Shortcut" field and press the desired keyboard combination (e.g.,
-
Create a Custom Workflow:
- Open Automator (you can find it in your Applications folder).
- Choose "Quick Action" as the document type.
- In the Library on the left, find and select "Files & Folders" under "Actions."
- Drag the "Get Selected Finder Items" action to the right workflow area.
- Below the "Get Selected Finder Items" action, find and select "Get Contents of Folder" under "Files & Folders."
- Find and select "Find Folder Containing File" under "Files & Folders."
- Find and select "Make New Folder with Date" under "Files & Folders."
- Find and select "Rename Finder Items" under "Files & Folders."
- Below the "Rename Finder Items" action, find and select "Get Folder Contents" under "Files & Folders."
- Find and select "Find Folder Containing File" under "Files & Folders."
- Find and select "Move Finder Items" under "Files & Folders."
- In the "Move Finder Items" action settings, set the destination folder to the folder where you want to store your tag files.
- Find and select "Get Specified Finder Items" under "Files & Folders."
- In the "Get Specified Finder Items" action settings, add the following:
- Find by Name: *.md, *.txt, *.html, etc. (add all file types you want to tag)
- In: the folder where you selected as the destination for the tag files in the "Move Finder Items" action
- Find and select "Get Metadata of Finder Items" under "Files & Folders."
- In the "Get Metadata of Finder Items" action settings, set the following:
- Metadata Type: Kind
- Only In: Finder Items
- Find and select "If" under "Logic" in the Library.
- In the "If" action settings, set the following:
- Compare: Metadata Value is equal to "Folder"
- If true: Do nothing (you can delete this action if you want the script to ignore folders)
- If false: Find and select "Get File Info" under "Files & Folders."
- In the "Get File Info" action settings, set the following:
- Info: Name, Kind, Tags
- For Each Item: Make a new list item
- Find and select "Set Finder Items' Tags" under "Files & Folders."
- In the "Set Finder Items' Tags" action settings, set the following:
- Tags: Your desired tag (e.g., "Tag1")
- Save your workflow and close Automator.
-
Test Your Custom Workflow:
- Select one or more files in Finder that you want to tag.
- Press the keyboard shortcut you assigned earlier (e.g.,
Command + T). - Your files should be moved to the destination folder, and a new folder with the current date should be created containing the tagged files. The files should also be tagged with "Tag1."
This workflow can be customized to suit your needs. You can add more tags, change the destination folder, or modify the file types the script handles.
Note: This script generates plain HTML output. To ensure the output HTML is valid, make sure to properly format your code blocks according to the programming language you're using, including indentation and tabulation as needed. Also, avoid using page layout tags like <div>, <hr>, etc., in your output.
References:
- Books:
- "Automator: Mac OS X Scripting Utility" by Steve Nash
- Articles:
- Online Resources: