MBP(はてな)

MacBook Pro,iPhone Xs,React

Apple Script

Script to switch between 2 resolutions - Apple Community
DisplayのScaledをMore SpaceにするApple Script

AppleScript のサンプルコード | DevelopersIO
キーボード操作

Macのサウンド出力先を切り替えるAppleScript - Sunflatの開発日記

control + space して、scri で検索。

command + r で実行

ドックの設定のアイコンを右クリックすると名称が確認できる

一覧を表示
tell application "System Preferences" to every pane

Tap to click を ONにする($ tap )

tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.trackpad"
end tell

do shell script "sleep 1s"

tell application "System Events"
tell application process "System Preferences" to tell tab group 1 of window "Trackpad"
click radio button 1
if value of checkbox 3 is 0 then
click checkbox 3
end if
end tell
end tell
quit application "System Preferences"

Tracking Speed を変更

参考

ディスプレイ解像度を変更する

tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.displays"
end tell

do shell script "sleep 1s"

tell application "System Events"
tell process "System Preferences"
click radio button "Display" of tab group 1 of window "Built-in Retina Display"
click radio button "Scaled" of radio group 0 of tab group 1 of window "Built-in Retina Display"
--get every UI element of radio group 0 of tab group 1 of window "Built-in Retina Display"

--左から3つ目(radio button 3)に変更
click radio button 3 of radio group 1 of group 2 of tab group 1 of window "Built-in Retina Display"
--get every UI element of radio group 1 of group 2 of tab group 1 of window "Built-in Retina Display"

end tell
end tell

quit application "System Preferences"



ディスプレイ設定変更

Favorites barを表示する safari

tell application "System Events"
tell process "Safari"
set frontmost to true
try
-- すでにFavorites barを表示している時は例外発生
click menu item "Show Favorites bar" of menu "View" of menu bar 1
on error

end try
end tell
end tell

参考

caps キーを command にする。

参考

tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
end tell

do shell script "sleep 1s"

tell application "System Events"
tell application process "System Preferences"
get properties

click button "Modifier Keys…" of tab group 1 of window "Keyboard"
tell sheet 1 of window "Keyboard"
click pop up button 2 -- show Caps Lock Key popup menu or 2
click menu item 4 of menu 1 of pop up button 2 -- select Command
click button "OK"
end tell
end tell
tell application "System Preferences" to quit
end tell




システム設定変更(sleep 1s必要)

sleep 1s

鳶嶋工房 / AppleScript / 入門 / AppleScriptってなに?

Macのキーボード入力、マウスクリックをJavaScriptで (JXA) - Qiita

ウインドウのサイズをAppleScriptで制御 : Macとの闘いの日々
ウィンドウサイズを変更
スクリプトをメニューに登録

AppleScript入門 (操作対象のアプリで利用できるコマンドを調べる) (Evernoteを自動バックアップ) - Qiita

コマンドで実行

Beginner's Tutorial

通知を表示