Applescript Terminal.appを使用して、画面に現在のテキストをコピーするにはどうすればよいですか?

StackOverflow https://stackoverflow.com/questions/529143

  •  22-08-2019
  •  | 
  •  

質問

Applescript Dictionaryでは、現在の画面のテキストと履歴バッファーがプロパティとして利用できることがわかります。

現在選択されている端末の内容をコピーするには、貼り付けバッファーにアプリをコピーするにはどうすればよいですか?

コマンドラインでできますか?

全歴史ログはどうですか?

役に立ちましたか?

解決

コマンドラインから現在選択されているターミナルの内容をコピーするには:

osascript <<END
  tell application "Terminal"
    tell front window
      set the clipboard to contents of selected tab as text
    end
  end
END

歴史のために:

osascript <<END
  tell application "Terminal"
    tell front window
      set the clipboard to history of selected tab as text
    end
  end
END
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top