Applescript 将装入的文件夹复制到本地文件夹

Applescript 将装入的文件夹复制到本地文件夹,applescript,mount,finder,Applescript,Mount,Finder,我们有一个samba共享,我想用applescript复制文件夹。这是我已经拥有的(安装工程): 这给了我一个错误: the routine can not edit objects of this class." number -10010 我尝试并组合了许多已经在使用的解决方案,例如 –OS X 10.9可能是源文件夹规范错误。 我认为您可以使用卷名而不是“smb://” (如果装载的卷名为“7samba.com”) 提示:将实际的sourcefolder从Finder拖动到AppleS

我们有一个samba共享,我想用applescript复制文件夹。这是我已经拥有的(安装工程):

这给了我一个错误:

the routine can not edit objects of this class." number -10010
我尝试并组合了许多已经在使用的解决方案,例如


–OS X 10.9

可能是
源文件夹
规范错误。 我认为您可以使用卷名而不是“smb://”

(如果装载的卷名为“7samba.com”)


提示:将实际的
sourcefolder
Finder
拖动到
AppleScript
中。它应该将路径粘贴到脚本中。将该路径用于
sourcefolder


更多:

您得到的错误是:

Mac OS error -10010 (telBadHTypeErr): bad hook type specified
我测试了它(使用两个本地文件夹),看看脚本是否可以工作。它确实起了作用,并复制了文件夹

您可以(或者无论如何应该)将关键代码包装到try块中,如下所示:

    try

        duplicate sourcefolder to localfolder

    on error the error_message number the error_number
        display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
    end try
tell application "Finder"
    set aBoolean1 to get (exists sourcefolder)
    set aBoolean2 to get (exists localfolder)
end tell

log aBoolean1
log aBoolean2
这样,您可以检查错误并对错误作出反应

添加:

也许你可以这样检查是否存在:

    try

        duplicate sourcefolder to localfolder

    on error the error_message number the error_number
        display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
    end try
tell application "Finder"
    set aBoolean1 to get (exists sourcefolder)
    set aBoolean2 to get (exists localfolder)
end tell

log aBoolean1
log aBoolean2

两个bool都必须是YES

此外,请从Finder的脚本字典中查找“duplicate”命令。谢谢。我仍然得到一个错误
Finder得到一个错误:Handler不能处理这个类的对象。(-10010)
我想Finder会将文件夹视为文件,因此会看到错误的对象?…当您将要从Finder复制到AppleScript文档的已装入卷上的文件夹拖动到其中时,“粘贴”的路径是什么。你用那条路了吗?更多:Finder知道很多项,我认为如果可能的话它会复制并正确引用。就是这样:卷名为
/Volumes/e_18_data11$/
,而不是
/Volumes/7samba.com/e_18_data11$/
;-)但是谢谢!!=>将实际的sourcefolder从Finder拖到AppleScript中。它应该将路径粘贴到脚本中。将该路径用于sourcefolder。我认为这应该能奏效。