2014-03-05 30 views
1

我在寫一篇AppleScript的拍照我選擇放它在/System/Library/PrivateFrameworks/LoginUIKit.framework/Versions/A/Frameworks/LoginUICore.framework/Resources,但每當我運行它得來的錯誤的腳本,說錯誤複製用戶所選擇的照片使用AppleScript

「340:354:執行錯誤:Finder出現錯誤:無法設置文件(別名「Macintosh HD:用戶:Samuel:圖片:4.jpg」)文件夾「Macintosh HD:System:Library:PrivateFrameworks:LoginUIKit.framework:Versions:A:框架:LoginUICore.framework:資源 「(-10006)(1)。」

osascript -e 'set this_file to choose file 
display dialog "Login Walls is now going to attempt to change the wallpaper." buttons {"Okay"} default button "Okay" 
tell application "Finder" 
    set apple to "apple.png" 
    copy folder "Macintosh HD:System:Library:PrivateFrameworks:LoginUIKit.framework:Versions:A:Frameworks:LoginUICore.framework:Resources" to file this_file 
end tell' 

上面的代碼片斷是從是從與管理員權限的小程序腳本調用.SH。

我真正需要做的是如果可以告訴我該怎麼做,該文件將被複制和重命名。

回答

2

一些事情......首先Finder沒有「複製」命令。 Finder的字典告訴我們複製不可用。它永遠不可用。改爲使用「重複」命令。其次,你想複製一個文件到一個文件夾。在你的代碼中,你將一個文件夾複製到一個沒有意義的文件中。第三,this_file已經是別名類型文件,因此copy命令中的this_file之前的單詞「file」不是必需的。當您的路徑爲字符串格式時(只適用於您的文件夾),您只需使用文件或文件夾。這不是this_file的情況,所以從命令中刪除word文件。

祝你好運。

相關問題