如何使用AppleScript Terminal.app复制屏幕上的当前文本?

如何使用AppleScript Terminal.app复制屏幕上的当前文本?,terminal,applescript,Terminal,Applescript,我在AppleScript字典中看到,当前屏幕的文本值和历史缓冲区作为属性可用 如何应用脚本将当前所选Terminal.app选项卡的内容复制到粘贴缓冲区 我可以在命令行上做吗 整个历史记录日志如何?要从命令行复制当前所选Terminal.app的内容,请执行以下操作: osascript <<END tell application "Terminal" tell front window set the clipboard to contents of s

我在AppleScript字典中看到,当前屏幕的文本值和历史缓冲区作为属性可用

如何应用脚本将当前所选Terminal.app选项卡的内容复制到粘贴缓冲区

我可以在命令行上做吗


整个历史记录日志如何?

要从命令行复制当前所选Terminal.app的内容,请执行以下操作:

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

osascript您是在查找命令历史记录还是终端缓冲区中的所有内容?终端缓冲区中的所有内容。命令历史很简单,只是“历史”。有时我想抓取一个异常或日志,但它离开了屏幕或全选是一件痛苦的事。我想做一个cmd行工具,这样做,也许会发送到一个新的要点。
osascript <<END
  tell application "Terminal"
    tell front window
      set the clipboard to history of selected tab as text
    end
  end
END