Monday, November 08, 2010 at 12:01 AM.
system.verbs.apps.FinderMenu.commands.typeCreatorDialog
local (f, selectionlist = FinderMenu.getSelectionList (), nofiles = true);
if sizeOf (selectionlist) == 0 {
dialog.alert ("Can't set types and creators because no files are selected in the Finder.");
return};
for f in selectionlist {
if not file.isfolder (f) {
local (origtype = string (file.type (f)));
local (origcreator = string (file.creator (f)));
findermenu.cards.data.typestring = origtype;
findermenu.cards.data.creatorstring = origcreator;
findermenu.cards.data.prompt = "File “" + file.fileFromPath (f) + "”:";
card.run (@findermenu.cards.typeCreator);
if defined (findermenu.cards.data.ok) {
delete (@findermenu.cards.data.ok);
if findermenu.cards.data.typestring != origtype {
file.settype (f, findermenu.cards.data.typestring)};
if findermenu.cards.data.creatorstring != origcreator {
file.setcreator (f, findermenu.cards.data.creatorstring)};
file.setmodified (file.folderFromPath (f), clock.now ());
Finder.update (f)};
nofiles = false}};
if nofiles {
dialog.alert ("Can't set types and creators because folders don't have type/creator attributes.")}
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.