I have a few droplets that take the files dropped on them one at a time and perform some steps. Simple, like this:
on open theseFiles
repeat with eachFile in theseFiles
--do stuff
end repeat
end open
Everything works fine, but I’m curious why the script works on the files in random order. It doesn’t go by name, or creation date, or anything obvious.
I believe it goes by File Number. You can do some quick checking by displaying each of the possible elements followed by the name as it cycles through your droplet.
How do you get the file numbers? I checked the index numbers of each file, which are also out of order, and don’t correspond to the order the script used the files. It doesn’t seem there’s any other item property that it may use.
FYI, to figure this out, I have ten text files, named 1, 2, 3, etc… that I’m using, and the test script looks like this:
on open theseFiles
tell application "Finder"
activate
repeat with eachFile in theseFiles
display dialog "File: " & (name of eachFile) & return & "Index: " & (index of file eachFile as string)
end repeat
end tell
end open