AppleScript告诉Finder移动-10000错误“处理程序无法处理此类对象”

时间:2014-05-21 14:04:24

标签: applescript finder

我已创建目录结构并将a文件放在A目录中:

~/A
~/B

在AppleScript中,我尝试将文件aA移至B 。这是我的代码:

on run

    tell application "Finder"
        move POSIX file "~/A/a" to POSIX file "~/B"
    end tell

end run

但是当我运行脚本时,我收到错误:

error "Finder got an error: Handler can’t handle objects of this class." number -10000

这是我的问题的简化版本。请有人帮帮我吗?

1 个答案:

答案 0 :(得分:5)

尝试:

set myFile to POSIX file (POSIX path of (path to home folder) & "A/a.txt")
set myFolder to POSIX file (POSIX path of (path to home folder) & "B")
tell application "Finder" to move myFile to myFolder

-- OR

set myFile to (path to home folder as text) & "A:a.txt"
set myFolder to (path to home folder as text) & "B"
tell application "Finder" to move myFile to myFolder