An AppleScript to hide extensions via drag and drop

Apr 11, '06 06:29:00AM

Contributed by: Anonymous

The recent discussion on hiding a file's extension led me to write this AppleScript:

on open (ItemList)
  set FileList to {}
  set FolderList to {}
  tell application "Finder"
    repeat with thisItem in ItemList
      if kind of thisItem is "folder" then
        copy thisItem to end of FolderList
      else
        copy thisItem to end of FileList
      end if
    end repeat
  end tell
  
  my processFiles(FileList)
  repeat with thisFolder in FolderList
    my splitFoldersFromFiles(thisFolder)
  end repeat
end open

on splitFoldersFromFiles(inputFolder)
  tell application "Finder"
    my processFiles(get files of inputFolder)
    set FolderList to folders of inputFolder
    repeat with thisFolder in FolderList
      my splitFoldersFromFiles(thisFolder)
    end repeat
  end tell
end splitFoldersFromFiles

on processFiles(FileList)
  repeat with thisFile in FileList
    tell application "Finder"
      set extension hidden of thisFile to true
    end tell
  end repeat
end processFiles

Save it as an application, and it will become a droplet. Simply drag files and/or folders containing files whose extension you wish to hide onto the droplet, and they'll be hidden.

Comments (3)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060405152924637