Applescript 转换为 Bash
我想确保 applescript 可以转换为 bash。关于如何做到这一点有什么想法吗?如果是这样,我将在下面放置一个简单的 applescript,为您提供脚本如何运行的示例。更清楚地说,我只是想要一个 bash 脚本或 shell 脚本来完成我的 applescript 正在做的事情。我希望它“启用”或更改系统首选项中开关的默认值,在“节能器”下显示...“电源故障后自动启动”...:
将 uiScript 设置为“单击复选框\”开始应用程序进程“系统偏好设置”窗口“节能器”第1组列表2的“断电后自动启动”“
运行脚本”告诉应用程序“系统事件” “&uiScript&” 结束告诉”
- 关于如何转换此脚本的任何想法?
谢谢, -Unimachead
I would like to make sure that an applescript can be converted to bash. Are there any ideas on how to do this? And if so, I'll place a simple applescript below to give you an example of how the script runs. In more clarity, I simply want a bash script or shell script to do what my applescript is doing. I want it to "enable" or change the default of the switch in system preferences, under "energy saver" that reads ...'start up automatically after a power failure'...:
set uiScript to "click checkbox \"Start up automatically after a power failure\" of list 2 of group 1 of window \"Energy Saver\" of application process \"System Preferences\""
run script "tell application \"System Events\"
" & uiScript & "
end tell"
- any ideas on how to convert this script?
Thanks,
-Unimachead
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您实际上可能不需要转换它 - 您可以使用 osascript 从 bash 脚本中运行 AppleScript。
$ man osascript
请注意,您可以从文件运行 AppleScript,也可以仅在命令行中包含源代码。
You may not actually need to convert it - you can run AppleScript from within a bash script, using
osascript
.$ man osascript
Note that you can run AppleScript either from a file or just include the source on the command line.