【问题标题】:AppleScript droplet that moves file移动文件的 AppleScript 小滴
【发布时间】:2016-11-12 22:26:29
【问题描述】:

尝试制作一个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

【问题讨论】:

    标签: applescript


    【解决方案1】:

    试试:

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

    【讨论】:

    • 甜蜜!!!! (我怎么知道语法是“打开文件”而不是“打开文件”?)
    • “of”没有区别。您的问题是您没有在 HFS 路径前包含“文件夹”。
    • 我很高兴它对你有用。请接受答案,以便其他用户知道该问题不再开放。
    【解决方案2】:

    要使用 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多