macos の spotlight でクリップボードのテキストを Automator.app を利用して翻訳などをしてみるメモ
(※翻訳以外のspotlightの操作も追記していくことにした)
翻訳など
- Automator.app で
アプリケーションを新規作成 シェルスクリプトを実行を選択- コマンドを記入して保存
コマンド
Google 翻訳(英語->日本語)
mojave
open "https://translate.google.co.jp/?sl=en&tl=ja&op=translate&text=`pbpaste`"
Big Sur (M1)
text=$(python3 -c "import sys, subprocess; from urllib.parse import quote;print(quote(subprocess.check_output('pbpaste', env={'LANG': 'en_US.UTF-8'}).decode('utf-8')))")
url="https://translate.google.co.jp/?sl=en&tl=ja&op=translate&text=${text}"
open "${url}"
英辞郎
open "https://eow.alc.co.jp/search?q=`pbpaste`"
全てのアプリケーションを終了させる
新規書類->アプリケーション- アクションで
全てのアプリケーションを終了を選択 quit_all_apps.appとかで保存
Music.app で再生・停止
AppleScriptを実行を選ぶ
on run {input, parameters} tell application "Music" playpause end tell end run
Play_or_Pause_for_Music.app とかで保存