Applescript错误

时间:2012-09-07 09:51:40

标签: applescript

我们正尝试使用终端命令通过Applescript安装应用程序,如下所述。首先,它将挂载dmg文件,然后将应用程序安装到App文件夹。 在将app安装到App文件夹时要求输入密码,如何使用Applescript处理此密码?

hdiutil mount /Users/rajasekaranr/Downloads/install_flash_player_osx.dmg"
sudo cp -R "/Volumes/Flash Player 2/Install Adobe Flash Player.app" /Applications 

使用Apple脚本执行上述命令时出错

error "sudo: no tty present and no askpass program specified" number 1

1 个答案:

答案 0 :(得分:1)

尝试:

property usr : "username"
property pswd : "password"

set fromPath to quoted form of "/Volumes/Flash Player 2/Install Adobe Flash Player.app"
set toPath to quoted form of "/Applications"
do shell script "cp -R " & fromPath & space & toPath user name usr password pswd with administrator privileges