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

时间:2009-02-09 17:48:33

标签: terminal applescript

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

AppleScript如何将当前选定的Terminal.app选项卡的内容复制到粘贴缓冲区?

我可以在命令行上执行此操作吗?

整个历史日志怎么样?

1 个答案:

答案 0 :(得分:1)

从命令行复制当前所选Terminal.app的内容:

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