开发者

Applescript conversion to Bash

开发者 https://www.devze.com 2022-12-22 02:50 出处:网络
I would like to make sure that an applescript can be converted to ba开发者_如何学编程sh. Are there any ideas on how to do this? And if so, I\'ll place a simple applescript below to give you an example

I would like to make sure that an applescript can be converted to ba开发者_如何学编程sh. 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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消