简体   繁体   中英

Why applescript doesn't accept file object in localized string command?

Following applescript throws error:

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

And the error is

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

What does this error means? localized string expects a file or alias object which thePath is then why this error?

FYI, localized string reference says:

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

The folder Application Support is not a file . Remove the file keyword.

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

But the code is meaningless because the folder Application Support is not a bundle either.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM