applescript 执行 shell 命令 "command not found"

applescript do shell command "command not found"

我是 applescript 和命令行工具的新手。 我安装了一个命令行工具来控制终端中 iMac 的亮度。我安装了以下内容: https://github.com/nriley/brightness

安装后,我注意到 /usr/local/bin/ 中有一个名为 "brightness" 的新 exec 文件。

互联网告诉我,applescript 只知道 /bin/sh 中的命令行。 "brightness" 在那里找不到,我无法将 exec 文件复制到该目录。所以这是有道理的,我在执行以下 applescript 时收到错误 "sh: brightness: command not found":

do shell script "brightness 0.7"

现在有个大问题,我必须做什么才能使 shell 命令正常工作? 在终端中,该命令运行良好。我知道我可以做到以下几点:

tell application "Terminal"
activate
end tell
tell application "System Events"
    keystroke "brightness 0.7"
    keystroke return
end tell

但这总是使终端 window 处于活动状态,我想 运行 静默执行命令。

很高兴收到详细说明。我在互联网上搜索了好几天,但是嘿,我是初学者。

提供完整路径

do shell script "/usr/local/bin/brightness 0.7"