2013-11-20 61 views
1

我們有一個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

+1

==>拖到從Finder中的實際sourcefolder到您的AppleScript。它應該將路徑粘貼到腳本中。爲源文件夾使用該路徑。我認爲應該這樣做。 – 2013-11-20 19:01:14

回答

2

這也許是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 

兩個布爾的必須是

+0

另外,從Finder的Scripting Dictionary中查找「duplicate」命令。 – 2013-11-20 18:05:04

+0

謝謝。我仍然得到錯誤 'Finder出錯:Handler無法處理這個類的對象。 (-10010)' – toefftoefftoeff

+0

我認爲Finder將文件夾視爲文件,因此錯誤的對象? – toefftoefftoeff

相關問題