Monday, November 08, 2010 at 12:01 AM.
system.verbs.apps.Finder.exists
on exists (obj) { <<Verify if an object exists
<<return (appleEvent (Finder.id, 'core', 'doex', '----', objspec (obj)))
case typeOf (obj) {
objspecType {
return (appleEvent (Finder.id, 'core', 'doex', '----', objspec (obj)))};
listType {
local (x, hasObject = false, hasOther = false);
for x in obj {
if typeOf (x) == objspecType {
hasObject = true}
else {
hasOther = true}};
if hasOther {
try {
obj = Finder.finderSpec (obj)}
else {
return (false)}};
if hasObject { << if it had non-object, that is now an object (and does exist)
<<if it also had one or more objects, we still have to ask about those
return (appleEvent (Finder.id, 'core', 'doex', '----', Finder.finderSpec (obj)))}}}
else {
try {
return (appleEvent (Finder.id, 'core', 'doex', '----', Finder.finderSpec (obj)))}
else {
return (false)}}}
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.