user1648855
user1648855

Reputation: 39

Applescript Error

We are trying to install an app thru Applescript using terminal commands as mentioned below. Firstly it will mount the dmg file and then install the app to App folder. While installing app to App folder its asking for password, how to handle this password using Applescript??

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

Error while executing the above commands using apple script

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

Upvotes: 1

Views: 1087

Answers (1)

adayzdone
adayzdone

Reputation: 11238

Try:

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

Upvotes: 1

Related Questions