making list sorted by modification date

hi, im really new at applescript and i’m trying to write a script to add numbers to the begining every item of a folder, starting with 01, sorted by modification date. The problem is, the “sort” function doesn’t seem to be working. The following is just the code i have to create a list of all the items in the frontmost window sorted by modification date (the rest of it doesn’t have any issues):

try
tell application “Finder” to set the source_folder to (folder of the front window) as alias
on error – no open folder windows
set the source_folder to path to desktop folder as alias
end try
set the item_list to list folder source_folder without invisibles
tell application “Finder”
set item_list to (sort every file of the source_folder by modification date)
end tell

thanks in advanced!

According to the Finder’s AppleScript dictionary in OS X 10.2.6: sort: (NOT AVAILABLE YET)

is there another way i can do this? A way without using the sort fucntion?

just curious…why are there so many replies saying to use the sort function if it isn’t yet availible? is there a way to make it available?

thanks in advanced

jake

I don’t know why there are replies suggesting the sort function. I haven’t noticed them. If you work at Apple, you might be able to make it available again. :wink:

You might be able to use GUI Scripting to do it. Once installed, something like this might work on the front Finder window.

tell application "Finder" to activate

tell application "System Events" to ¬
	tell application process "Finder" to ¬
		tell button 2 of group 1 of outline 1 of scroll area 1 of window 1 to click

This script will produce unexpected results if the order of the columns is different than mine, so it might need tweaked. It definitely needs more work as far as error checking and stuff like that. All I can say is that it works here - as if I clicked the “Date Modified” column header in the window (which is the second column in this case).