Droplet - Process files in order of earliest creation date

Hi Scripters,

I’m try to figure out how to get my Applescript droplet to process the files dropped on it in the order of the files creation date (process earliest first).

Any suggestions would be greatly appreciated,
CarbonQuark

Basics of my script:



on open (excelFiles)
	repeat with x from 1 to count of excelFiles
		tell application "Microsoft Excel"
			open item x of excelFiles
			-- file process goes here
		end tell
	end repeat
end open


Hi,

the easiest way:

on open (excelFiles)
	tell application "Finder" to set excelFiles to sort excelFiles by creation date
	repeat with oneFile in excelFiles
		tell application "Microsoft Excel"
			open oneFiles as alias
			-- file process goes here
		end tell
	end repeat
end open

Thanks Stefan.

This works. However, it sorts the files with the newest first instead of the oldest. I have a repeat loop to coorect the order. If there is a better way let me know.

Thanks,
CarbonQuark

no problem

on open (excelFiles)
	tell application "Finder" to set excelFiles to reverse of (sort excelFiles by creation date)
	repeat with oneFile in excelFiles
		tell application "Microsoft Excel"
			open oneFiles as alias
			-- file process goes here
		end tell
	end repeat
end open

PS: please post these problems into the OS X forum, this is the OS 9 forum :wink:

StephanK,

NICE!

Thanks,
CarbonQuark