将装载的文件夹复制到本地文件夹
我们有一个samba共享,我想从哪里复制文件夹与一个applescript。这是我已经有(安装工程):将装载的文件夹复制到本地文件夹
mount volume "smb://samba.com/e_18_data11$"
delay 3
set sourcefolder to ("smb://samba.com/e_18_data11$/e_18_data11$/folder1/folder2" as POSIX file)
set localfolder to ("/Users/username/Dropbox/Test" as POSIX file)
tell application "Finder" to duplicate sourcefolder to localfolder
这给了我还是这个错误:
the routine can not edit objects of this class." number -10010
我试图和已经在如此地结合了许多解决方案,例如this solution
- OS X 10.9
这也许是sourcefolder
规范,是错误的。 我想你可以使用卷名而不是“smb://”。
set sourcefolder to ("/Volumes/7samba.com/e_18_data11$/e_18_data11$/folder1/folder2" as POSIX file)
(如果安装的卷名为 “7samba.com”)
提示:拖动从Finder
实际sourcefolder
到您的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
两个布尔的必须是
另外,从Finder的Scripting Dictionary中查找“duplicate”命令。 – 2013-11-20 18:05:04
谢谢。我仍然得到错误 'Finder出错:Handler无法处理这个类的对象。 (-10010)' – toefftoefftoeff
我认为Finder将文件夹视为文件,因此错误的对象? – toefftoefftoeff
==>拖到从Finder中的实际sourcefolder到您的AppleScript。它应该将路径粘贴到脚本中。为源文件夹使用该路径。我认为应该这样做。 – 2013-11-20 19:01:14