Create SmartFolder from List of Tags

Recently came across this article about Tags and smartfolders based on tags by Dr. Drang
https://leancrew.com/all-this/2018/10/a-little-tagging-automation/
Dr Drang has used python & jdBerry’s Tag to accomplish the task
I do not get to install any piece of software on machines, wondering if had any vanilla applescript / AsObjC solution to create smart folder
I use this Handler to get list of Tags of file/ folder

-- Handler {Get Tags for seleceted Files/ Folders} 
on returnTagsFor:posixPath -- get the tags
	set aURL to current application's |NSURL|'s fileURLWithPath:posixPath -- make URL
	set {theResult, thetags} to aURL's getResourceValue:(reference) forKey:(current application's NSURLTagNamesKey) |error|:(missing value)
	if thetags = missing value then return {"NO Tags"} -- because when there are none, it returns missing value
	return thetags as list
end returnTagsFor:

Any pointers wud be helpful
Cheers

Tags can be read and set with the xattr command. This article by Brett Terpstra gives a good explanation of how to do it. I have no direct experience with doing it this way, because I’ve been able to use tag.

Thanks Dr Drang, was hoping to programmatically create smart Folders with tag list from the handler
Idea was to check tags on a selected file, and create smart folder for files with similar tags.
I think it wud manual for now. Thank you for ur time Cheers

1 Like