Unimachead
Unimachead

Reputation: 13

Applescript conversion to Bash

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"

Thanks, -Unimachead

Upvotes: 1

Views: 3678

Answers (1)

Paul R
Paul R

Reputation: 212949

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.

Upvotes: 8

Related Questions