Home Archives
 

Today's Date

Tuesday February 07, 2012

Friends & Family

Stock Quotes

Latest Joy of Tech

Latest Joy of Tech!
A Folder Action to Sort Files/Folders Like OS 9 Print E-mail
Wednesday, 19 October 2005 10:19

Under OS 9 and earlier Mac OSes, you could force an item in a Finder window to sort down to the bottom of a list by putting a bullet [Option+8] (or any number of other option-characters) in front of the name.

This doesn't work under OS X where putting a bullet in front of your file's name forces it to the top of an alphabetical list.

I've tried other option-characters, but I'm not satisfied with them. The best character that will sort to the bottom of an alphabetical file-list is [Option+N], which resembles a ~ tilda. But I want my bullets at the bottom.

I've finally gotten around to "fixing" the OS to sort the way that I want it to. My method uses a Folder Action and the seldom-used Comments field to sort bulleted names to the bottom of the file list. It only works in the Finder -- bulleted items will appear the the top of an alphabetical list in a dialog box. Still, it makes OS X feel a lot more comfortable.

Copy and paste the code into a new document in the Script Editor, save it to the "/Library/Scripts/Folder Actions" folder and use the contextual menu to attach it to a folder. From that point on, bulleted items in the folder will appear at the bottom of the file-list when you open that folder.

You can use any character you'd like instead of a bullet just by changing two lines in the script. Here's the code:

on opening folder this_folder

tell application "Finder"
set thisfolder to Finder window 1
set current view of thisfolder to list view
set countfiles to count of thisfolder

if countfiles < 2 then error number -128

set visible of column comment column of list view options of front window to true
set width of column comment column of list view options of front window to 1
set sort column of list view options of front window to comment column

repeat with n from 1 to countfiles
set path_to_item to item n of thisfolder as text
set AppleScript's text item delimiters to ":"
set x to ((count of (text items of path_to_item)) - 1)
set item_name to text item x of path_to_item

set AppleScript's text item delimiters to ""
if item 1 of item_name = "•" then
set comment of (item path_to_item) to ("•" as string)
end if

end repeat

end tell
end opening folder

Comments

No comments have been added yet. Be the first to comment...

Add a New Comment

 
 
 
 
 
 
 
Joomla Templates by Joomlashack