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

system.verbs.apps.Finder.cleanUp

on cleanUp (obj, by = nil) { <<Arrange items in window nicely
	if typeOf (by) == longType {
		try {
			if by < 2 {
				scriptError ("bad code")};
			by = Finder.defs.cleanupCodes.[string(by)]^}
		else {
			scriptError ("Cannot use code " + by + " with Finder.cleanup.")}};
	if typeOf (obj) == listType {
		local (result = {}, ix);
		for ix = 1 to sizeof (obj) {
			result = result + Finder.cleanUp (obj[ix], by)};
		return (result)};
	if typeOf (obj) != objspecType {
		with objectModel, Finder {
			obj = finderSpec (obj);
			obj = obj.containerWindow}};
	return (appleEvent (Finder.id, 'fndr', 'fclu', '----', Finder.finderSpec (obj), 'by  ', string4 (by)))}



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.