AppleScriptはじめました.その3
実践1
TimeMachineをオンにするスクリプトを試しに書いてみた.
ウィンドウの中身を調べるには
tell application "System Preferences"
get pane of it
end tell
とか
tell window "なんか"
every UI element
end tell
みたいなのを調べてがんばるw
activate application "System Preferences"
tell application "System Events"
tell process "System Preferences"
click menu item "Show All Preferences" of menu 1 of menu bar item "View" of menu bar 1
click button "Time Machine" of scroll area 1 of window "System Preferences"
set X to button "ON" of window "Time Machine" of application process "System Preferences" of application "System Events"
if X = true then
else
click X
end if
end tell
end tell
おお,めちゃ簡単!