I have an Applescript app that can receive files or folders dropped onto its icon:
on open theDroppedItems
tell application "Finder"
set droppedItemSourcePath to (the POSIX path of theDroppedItems)
...
At this point of the script, when my app receives a file or a folder, an unknown and useless Applescript application named "Droplet" displays an open file/folder dialog. My script was compiled as application with Script Debugger 6.
I don't understand why this strange "Droplet" app asks me something.
The mistake is that theDroppedItems
is a list of alias
specifiers even if only one file was dropped and getting the POSIX path of a list throws an error
To get all POSIX paths of the dropped items use
on open theDroppedItems
set {TID, text item delimiters} to {text item delimiters, return}
set droppedItemsSourcePaths to POSIX path of (theDroppedItems as text)
set text item delimiters to TID
display dialog droppedItemsSourcePaths buttons {"OK"} default button "OK"
...
To process the files one by one use a loop
on open theDroppedItems
repeat with anItem in theDroppedItems
-- do something with anItem
end repeat
...
Use a Finder tell
block only if you are going to use Finder terminology.
The mentioned Droplet
is your app.