Why does Applescript sometimes split up the selection and run twice?
Sorry if I missed an existing post on this: After searching other forums and posting to the Apple developer forum, I have not found an answer. I’ve seen the question of why AS runs twice (not necessarily related to a drop app), asked but not answered, in several locations.
I have this down to a single command (display dialog) to the Open handler:
on open these
display dialog the number of items in these
-- To display each item:
set k to 0
repeat with anItem in these
set k to k + 1
set s to anItem as text
display dialog "Item " & k & " = " & s
SOMETIMES the app runs once, as I’d expect, and the dialog displays the number of items I dragged, but SOMETIMES it splits them up, the app will run again, displaying the remainder of the dropped items. Why?
¢ It has run once, as expected with different kind files dropped, but run twice with same kind files dropped. I have made a multiple selection that runs once, added another file of the same kind already in the selection, and it runs twice. File kind doesn’t seem to explain it.
¢ I have dropped 8-10 files and it runs once, and just two files and it runs twice. Number of items doesn’t seem to explain it.
Many thanks in advance for any insight into this!