繁体   English   中英

如何将值从苹果脚本传递到 Automator 中的 shell 脚本?

[英]How to pass value from apple script to shell script in Automator?

我计划运行 shell 脚本,然后运行 AppleScript。 但我想知道是否可以将参数值传递给 shell 脚本,如下所示。

在此处输入图像描述

我收到一些我不明白的奇怪错误。 有人可以帮我理解错误并提供一种将值(继续/不继续)从 Apple Script 传递给 Shell 脚本的方法吗?

文本格式的代码:

on run {input, parameters}

   set theDialogText to "By running this script, it will update your hosts file. Would you like to continue?"

   set isupdate to display dialog theDialogText buttons {"Don't Continue", "Continue"} default button "Continue" cancel button "Don't Continue"

return {isupdate}

结束运行

首先,请发布文本,而不是图像。

发生错误是因为display dialog返回一条记录(就 Objective-C 而言是字典),但参数必须是字符串。

你必须写

set isUpdate to button returned of (display dialog ... )

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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