user1720207 user1720207 - 26 days ago 10
AppleScript Question

AppleScript droplet that moves file

trying to make an AppleScript droplet that moves a file to a given folder when the file is dragged to the droplet; not sure how to tell the script that the file I just dragged is the one I want to move; I tried this but it doesn't work:

on open dragged_file
tell application "Finder"
move dragged_file to "Macintosh HD:Users...etc."
end tell
end open --script runs but doesn't move file

Answer

Try:

on open of theFiles
    tell application "Finder"
        move theFiles to folder "Macintosh HD:Users...etc."
    end tell
end open