XCode构建阶段:在shell脚本中运行AppleScript

时间:2017-03-13 11:19:57

标签: xcode applescript

我遇到问题:

BUILD_CONFIRM_SCRIPT="
    try
        tell application \"Xcode\" to display dialog ¬
        activate
\"Do you want to run the translation script? This will take longer to build, but ensure you have the latest translations.\" with title \"Run translation script?\" with icon caution
        return \"Yes\"
        end tell
    on error
        return \"No\"
    end try
"
if [[ $($BUILD_CONFIRM_SCRIPT) == 'No' ]]; then
    exit 0
fi

...

我要做的是: 我有这个shell脚本,它接收本地化文件并使用它来覆盖所有Storyboard / XIB本地化及其各自的翻译,以避免必须通过代码完成所有这些。

上面的代码应该显示一个XCode对话框,提示开发人员确认或拒绝执行翻译脚本。执行此操作需要相当长的时间并且显着减慢构建过程,但幸运的是,没有必要每次都执行此操作。所以我想使用上面的脚本来中止执行下面的指令(参见...),如果开发人员不想要或看不到它。

运行上述脚本会产生错误

Syntax error: Expected expression, but found unknown token (-2741)

(自由翻译,因为原始的错误信息是另一种语言),经过一段时间的研究后,现在是时候了。

有关背景信息,这是我从https://cantina.co/adding-interactivity-to-the-xcode-build-process/

检索原始代码的资源

非常感谢任何帮助! :)

0 个答案:

没有答案