1

我正在尝试编写一个 Apple 脚本,它将两个文件从一个文件夹复制到另一个文件夹。我尝试了不同的方法,但我不断收到错误消息。

方法一:

tell application "Finder"

    set home_path to home as text

    set framework to alias (home_path & "Library:Developer:Xcode:DerivedData:ReaderKit-cusaxqpwrepxbfcmixaiszkolkkv:Build:Products:Debug-iphoneos:ReaderKit.framework")

    set bundle to alias (home_path & "Library:Developer:Xcode:DerivedData:ReaderKit-cusaxqpwrepxbfcmixaiszkolkkv:Build:Products:Debug-iphoneos:ReaderKit.framework")

    set destination to home_path & "Documents:WillowTree:BIA-Kelsey:BIA-Kelsey:ThirdParty"

    duplicate file framework to folder destination with replacing
    duplicate file bundle to folder destination with replacing
end tell

方法二

tell application "Finder"

    set framework to "Macintosh HD:Users:nayef:Library:Developer:Xcode:DerivedData:ReaderKit-cusaxqpwrepxbfcmixaiszkolkkv:Build:Products:Debug-iphoneos:ReaderKit.framework"

    set bundle to "Macintosh HD:Users:nayef:Library:Developer:Xcode:DerivedData:ReaderKit-cusaxqpwrepxbfcmixaiszkolkkv:Build:Products:Debug-iphoneos:ReaderKit.bundle"

    set destination to "Macintosh HD:Users:User:nayef:Documents:WillowTree:BIA-Kelsey:BIA-Kelsey:ThirdParty"

    duplicate file framework to folder destination with replacing
    duplicate file bundle to folder destination with replacing
end tell

错误

error "Finder got an error: Can’t set folder \"Macintosh HD:Users:User:nayef:Documents:WillowTree:BIA-Kelsey:BIA-Kelsey:ThirdParty\" to file \"Macintosh HD:Users:nayef:Library:Developer:Xcode:DerivedData:ReaderKit-cusaxqpwrepxbfcmixaiszkolkkv:Build:Products:Debug-iphoneos:ReaderKit.framework\"." number -10006 from folder "Macintosh HD:Users:User:nayef:Documents:WillowTree:BIA-Kelsey:BIA-Kelsey:ThirdParty"

我的脚本有什么问题?

4

1 回答 1

2

这是因为“ReaderKit.framework”不是文件,使用文件夹项目别名

duplicate folder framework to folder destination with replacing
于 2012-05-31T21:01:57.863 回答