2014-03-05 19 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文件。

祝你好运。

相关问题