一、新建 AppScript 步骤
1.1 找到“自动操作”
启动台中找到自动操作,如下图
1.2 新建程序
文稿类型选择应用程序。
搜索 AppleScript,并拖到右侧。
1.3 替换代码
删除红框圈中代码,并用新代码替换。(新代码在目录二)
保存文件。名字随意,注意后缀为 .app;位置选择应用程序文件夹,并且确认文件格式为应用程序。
1.4 使用
右键 apk 文件,在打开方式中,选择其他,然后选择你刚刚创建的应用程序(注意你起的名字)。
注意:因为我这里之前选过了,所以它直接出现在第一位。
注意勾选始终以此方式打开。
二、代码
on run {input, parameters}
(* 双击安装 apk *)
tell application "Terminal"
set thePath to quoted form of POSIX path of input as string
do script "adb install -r " & thePath
activate
end tell
end run