2011-06-06 73 views
3

我尝试使用下面的代码把一个彩色标签上的文件使用AppleScript:标签设置到文件使用AppleScript

set theFile to "HDD:Path:to:the:file.ext" 

tell application "Finder" 
    set label of file theFile to 3 
end tell 

,但是当我在终端与osascript theScript.scpt运行它,我得到的以下错误:

theScript.scpt:144:178: execution error: Finder got an error: Can't set label of document file "file.ext" of folder "the " of folder "to" of folder "Path" of startup disk to 3. (-10006)

任何想法,为什么我有问题,我该如何使它工作?

+0

“中的”空间的问题? – ykatchou 2011-06-06 11:18:46

回答

7

应编码为label index不是label,它需要有一个alias

set theFile to "HDD:Path:to:the:file.ext" as alias 
tell application "Finder" to set label index of theFile to 3 
相关问题