使用管理员权限从 shell 脚本调用 applescript [英] Calling applescript from shell script using admin previleges

查看:29
本文介绍了使用管理员权限从 shell 脚本调用 applescript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个 shell 脚本,该脚本运行安装程序(由 ViseX 提供)并通过列表选择安装程序中的不同项目.安装程序需要管理员权限才能正常运行,但我不想使用 sudo.当前安装应用程序无法正常工作,因为它没有以管理员权限运行.

I'm running a shell script that runs an installation program (by ViseX) and selects different items in the installer through a list. The installer needs administrator privileges to run properly, but I don't want to use sudo. Currently the installation application does not work properly because it does not run with admin privileges.

如何以管理员权限调用applescript 或告诉applescript 中的安装应用以管理员身份运行?

How do I call the applescript with admin privileges or tell the installation app inside the applescript to run as admin?

这是我正在使用的applescript:

Here's the applescript I'm using:

osascript <<-END
  tell application "$1"
    with timeout of 8 * 3600 seconds
     activate
     Select "$2"
     DoInstall
   end timeout
 end tell
END

推荐答案

do shell script "[path/to/app] [param]" user name "[admin name]" password "[password]" with administrator privileges

这篇关于使用管理员权限从 shell 脚本调用 applescript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆