Monday, November 08, 2010 at 12:01 AM.
system.verbs.apps.Finder.erase
on erase (obj) { <<Erase the specified disk(s)
<<Because Finder puts up a dialog, Finder should be brought to the front first
local (result, wasFront);
with objectModel, Finder {
wasFront = get (process[frontmost == true]);
if wasFront != {} { << Current Scriptable Finder returns {} if Finder was in front
<<and won't get the name of a "process object", which is really a 'psn '
wasFront = get (process[frontmost == true].name)};
bringToFront ();
result = appleEvent (Finder.id, 'fndr', 'fera', '----', finderSpec (obj));
if wasFront != {} { << Current Scriptable Finder returns {} if Finder was in front
sys.bringAppToFront (wasFront)};
return (result)}} << An object spec for the disk under its old name!
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.