AppleScript告诉查找器移动-10000错误“;处理程序可以’;t处理此类对象“;

AppleScript告诉查找器移动-10000错误“;处理程序可以’;t处理此类对象“;,applescript,finder,Applescript,Finder,我已经创建了目录结构,并将a文件放在a目录中: ~/A ~/B 在AppleScript中,我试图将文件a从a移动到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

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

~/A
~/B
在AppleScript中,我试图将文件
a
a
移动到
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
这是我问题的简化版本。有人能帮我吗?

试试:

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
或:


有什么解释为什么我的问题得到-1吗?如果我使用/Users/username/A | B,我得到-10010解释-dstPath:srcPath中项目的新路径。此路径必须在其新位置包含文件或目录的名称。这对你有用吗@adayzdone?我试图重新启动Finder并重新启动OSX,以防运行时出现问题或其他情况。。。是否确定文件名为a而不是a.txt?将文件拖到AppleScript编辑器中打开的脚本上,以获取其完整路径。这很难承认,但是是的。。。你的文件扩展名@adayzdone是对的-编辑你的帖子,我会接受你的回答。错误消息对我来说是错误的,实际上我已经检查了
POSIX文件之间是否有差异。。。“A/A”
POSIX文件。。。“A/A.txt”
并且它们都是furl类,因此错误消息没有意义。@Asbjørn Ulsberg,这是一个相当多余的编辑,特别是考虑到将代码的现有制表符缩进替换为“``applescript”显然不会对applescript代码应用语法高亮显示!唯一需要改进的是“改变”--或“改变”或:“。因此是多余的编辑。看看:我做了编辑,将
--OR
更改为
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