以前にiPhoneとiPadでAirPodsにワンタップで接続する方法を紹介しました。この方法は、Macには対応していないため、色々方法を探してみたのですが、良い方法が見つからなかったので、スマートではないですが、AppleScriptで作ってみました(初めてAppleScriptを触ったので無駄な部分や間違っている部分があるかもしれません)。また、MacにAirPodsが接続されている状態で実行するとエラーになりますのでご注意を。
バージョン:macOS Sonoma 14.0
次のGifのとおりAppleScriptのウインドウ操作で設定アプリ→Bluetooth→AirPods Proの「i」→接続→ウインドウを閉じるといった流れです。もっとスマートなやり方があったら教えてくださいm(_ _)m

tell application "System Settings"
activate
delay 2
reveal pane "Bluetooth"
end tell
tell application "System Events" to tell application process "System Settings"
tell window "Bluetooth"
delay 1
tell group 2 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1
tell button 1
click
end tell
end tell
end tell
end tell
tell application "System Events" to tell application process "System Settings"
tell window 1
tell sheet 1
activate
tell button 2 of group 1
delay 2
click
delay 2
end tell
tell button 3 of group 1
delay 5
click
end tell
end tell
end tell
end tell
tell application "System Events" to tell application process "System Settings"
tell button 1 of window 1
click
end tell
end tell
MacのショートカットアプリにAppleScriptとして登録しておいて、ウィジェットやメニューバーで実行することもできます。


