I need to create workflow that allows the user to drop files onto the application and then have those files moved to a particular folder to be processed based on their file type.
So far, I've not got past the drag, drop, and move part!
on open theDroppedItems
repeat with a from 1 to length of theDroppedItems
set theCurrentDroppedItem to item a of theDroppedItems
tell application "Finder"
set folderSpool to folder "Spool" of desktop
move a to folderSpool
end tell
end repeat
end open
When I do the drag and drop, I get:
Handler can’t handle objects of this class. Finder got an error:
Handler can’t handle objects of this class. (-10010)
I tried item
instead of a
, but that gave me the same error.
It's been a long time since I used AppleScript…
Best Answer
Change the following line of code from:
To:
In your code,
a
is an integer, indexedfrom 1 to length of theDroppedItems
, so you were trying to move an integer (which of course you can't) not the file, which istheCurrentDroppedItem
.