【发布时间】:2019-03-14 19:12:33
【问题描述】:
我正在开发 Java GUI,我正在尝试制作一个可以使用给定电话号码启动 FaceTime 通话的按钮。这是java代码的一个过度简化的版本。
String cellNum = "18001234567";
try {
Runtime.getRuntime().exec("open /Users/faris/Desktop/call.app --args " + cellNum);
} catch (IOException e) {
e.printStackTrace();
}
在研究了如何做到这一点后,我复制了我在网上找到的 AppleScript 应用程序的一部分,我将其命名为 call.app 并对其进行了修改,使其接受输入参数电话号码,而不是手动将其输入到脚本中。我已经用输入的实际电话号码而不是输入变量来运行程序,它工作正常,所以我知道问题在于传递参数。
call.app
on run args
set input to first item of args
open location "tel://" & input & "?audio=yes"
delay 1
tell application "System Events"
key code 36
end tell
end run
这是我每次从 AppleScript 中得到的错误。
Can’t get item 1. (-1728)
我以前从未使用过 AppleScript,所以我现在完全迷路了。在 SO 上的任何地方都没有发现任何类似的东西。任何建议将不胜感激。
【问题讨论】:
标签: java macos terminal arguments applescript