Monday, November 08, 2010 at 12:01 AM.


on duplicate (obj, duplicateTo = nil, replacing = nil) {
	<<Duplicate object(s).  duplicateTo (if present) must refer to a container
	<<Replacing can be false (the default), in which case it is an error if there already is a file with the same name
		<<in the duplicateTo container;
		<<or true, conflicts, or existingItems in which case the newly created file(s) replaces existing file(s)
	<<on adjustDuplicateTo (dupSpec)
		<<case typeOf (dupSpec)
				<<local (x, newList = {})
				<<for x in dupSpec
					<<newList = adjustDuplicateTo (x)
				<<return (newList)
				<<return (filespec (dupSpec))
			<<return (dupSpec)
	if Finder.isScriptable () {
		if typeOf (duplicateTo) != unknownType {
			duplicateTo = Finder.insertionSpec (duplicateTo)};
		return (appleEvent (, 'core', 'clon', '----', Finder.finderSpec (obj), 'insh', duplicateTo, 'alrp', replacing))}
	else {
		return (Finder.folderVerb ('sdup', string(obj)))}}

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.