Safari で YouTube の自動再生をトグルする
YouTube、たくさんショートカットキーが用意されているのに、自動再生をトグルするショートカットキーは存在しないんですよね… なんでなんでしょうね…
と思ったので AppleScript を書きました。
AppleScript
以下の通りです。シアターモードとデフォルト表示でのみ動作します(全画面時とミニプレーヤーには非対応)。設定言語に関わらず動くはずですが、拡張機能などの有無によって動かない可能性はあります(動かなかったらコメントください)。
AppleScript
tell application "System Events" to tell process "Safari" to tell first window
tell group 1 of (first group whose subrole is not "AXEmptyGroup") of group -3 of UI element 1 of scroll area 1 of group 1 of group 1 of tab group 1 of splitter group 1
if button 1 of group -1 of group 1 exists then
click button 1 of group -1 of group 1
else if button 1 of group -1 exists then
click button 1 of group -1
end if
end tell
end tell
この AppleScript を Apple 純正「ショートカット」アプリでショートカットキーに割り当てれば完璧ですね(割り当て方はこの記事を参照)。
簡略的な解説
この AppleScript は「YouTube の自動再生ボタンをクリック」しているだけです。
質問があればコメントにどうぞ。