2014-05-21 21 views
3

我創建的目錄結構和放置在a文件A目錄:的AppleScript告訴Finder來移動-10000錯誤「處理程序無法處理這個類的對象」

~/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 

這是簡化版本。有人可以幫我嗎?

+0

任何的解釋,爲什麼我得到-1這個問題? –

+0

如果我使用/用戶/用戶名/ A | B我得到-10010 –

回答

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 
+0

它仍然是-10000 –

+0

它是否適合你@adayzdone?我試圖重新啓動Finder並重新啓動OS X,以防萬一它在我的運行時出現問題或其他問題...沒有幫助 –

+1

確定文件名爲a而不是a.txt?將文件拖到AppleScript Editor中的打開腳本上以獲取完整路徑。 – adayzdone