Copy window contents into Excel

Hi there-

I’d like my script to copy the file names of the contents (folders/sub folders/jpeg NAMES) of window 1 and paste them into an excel spread sheet in the order they appear in window 1? Is this possible? I haven’t been able to paste into excel in the correct order.

Any help is appreciated. Thanks!

J

The order of files listed when you ‘get every file of folder xxx’ is undetermined.

I’ve never seen any documentation that explains how the Finder sorts the list, but it seems to be alphabetical (although I do recall that not always being the case, so it may have changed at some point).

The only way you’ll get the files in some different order is to sort them yourself. If working with column views, it’s easy enough to sort files by modification date, or size, or however else you’re viewing the folder, but in the case of wanting them in the order they appear in icon view you’ll need to get every icon’s position and sort the list based on that.