【问题标题】:Why applescript doesn't accept file object in localized string command?为什么applescript不接受本地化字符串命令中的文件对象?
【发布时间】:2017-04-19 00:05:54
【问题描述】:

以下 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

【问题讨论】:

    标签: macos localization applescript localizable.strings applescript-objc


    【解决方案1】:

    文件夹应用支持不是一个文件。删除 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 也不是捆绑包。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-09-01
      • 1970-01-01
      • 2013-12-01
      • 2013-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多