移动文件的AppleScript小滴

时间:2012-11-05 15:06:38

标签: applescript

尝试制作AppleScript Droplet,将文件拖动到Droplet时将文件移动到给定的文件夹;不知道如何告诉脚本我刚刚拖动的文件是我要移动的文件;我尝试了这个,但它不起作用:

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

2 个答案:

答案 0 :(得分:1)

尝试:

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

答案 1 :(得分:0)

要使用Droplet,您必须在draggeditem中引入带有currentitem的循环重复 现在你的脚本 然后结束重复 为你的例子

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