0

繼AppleScript的拋出錯誤:爲什麼applescript不接受本地化字符串命令中的文件對象?

set thePath to path to application support from user domain as alias 
set mystr to localized string "Add people to this note" in bundle file thePath 

和錯誤是

error "Can’t make file (alias \"Macintosh HD:Users:shakes:Library:Application Support:\") into type file." number -1700 from file (alias "Macintosh HD:Users:shakes:Library:Application Support:") to file 

這個錯誤是什麼意思嗎? localized string預計會出現一個filealias對象,其中thePath爲何會出現此錯誤?

僅供參考,localized string reference說:

Syntax 
localized string text required 
from table text optional 
in bundle fileSpecifier optional 

回答

0

文件夾應用支持是不是文件。刪除file關鍵字。

set thePath to path to application support from user domain -- as alias is redundant 
set mystr to localized string "Add people to this note" in bundle thePath 

但代碼沒有意義,因爲文件夾Application Support不是一個包。

相關問題