Tags

This is a script that lets you use a tagging system in the Finder of Mac OS X, if compiled correctly (as an application bundle).

The script contains three routines: a run handler, an open handler and the name_helper function. All three routines work on a folder inside the application bundle which will have the same name as the tag (except for the .app extention). This folder will from now on be called the internal folder.
The run handler will open the internal folder in a new finder window, in icon view. It makes use of the name_helper function to find the internal folder.
The open handler will add alias files, linking to the input items, to the internal folder. It makes use of the name_helper function to find the internal folder.
The name_helper function will determine what the name of the internal folder should be, performs a check whether it already exists, creates it when it doesn’t, and finally returns the path to the internal folder.

It has been released as a full package at sourceforge.net: http://sourceforge.net/projects/free-mac-tags/

A screenshot of the software as released at sourceforge, showing how to tag an item:

I hope nobody will take offense from the license comment, i have to include it because of the above mentioned registration at sourceforge. Luckily it is a very permissive license. :slight_smile:

-- this script should be saved as an application bundle
-- without an opening screen!
(*
Copyright (c) 2007 Julian Gonggrijp (julian_gong @ http://sourceforge.net/projects/free-mac-tags/), StefanK @ http://macscripter.net

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*)

on run
	set target_folder to name_helper()
	tell application "Finder"
		tell (make new Finder window to target_folder)
			set current view to icon view
		end tell
	end tell
end run

on open these_items
	set the target_folder to name_helper()
	tell application "Finder"
		repeat with item_i in these_items
			make new alias file to item_i at the target_folder
		end repeat
	end tell
end open

on name_helper()
	set the tag_name to text 1 thru -5 of (name of (info for (path to me)))
	set the container_path to (the path to me as Unicode text) & "Contents:"
	try
		return (the container_path & the tag_name) as alias
	on error
		tell application "Finder"
			return (make new folder at the container_path with properties {name:the tag_name})
		end tell
	end try
end name_helper