【问题标题】:Get osx screencapture terminal tool to capture both screens获取 osx screencapture 终端工具来捕获两个屏幕
【发布时间】:2014-03-07 13:53:51
【问题描述】:

screencapture 终端应用程序非常完美,可以按照您的预期截取屏幕截图,但如果您连接了两个屏幕,它只会截取主窗口的屏幕截图。

screencapture screenshot.png

但如果您使用CMD + Shift + 3,它会同时获取两个屏幕并将它们保存为两个屏幕截图。

手册页有一个参数-m,上面写着Only capture the main monitor,但正如您所见,我不使用该参数,然后您会假设它会占用两个屏幕,但不是。

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/screencapture.1.html

如何让 screencapture 获取两个屏幕或对其进行编程以获取第二个屏幕的屏幕截图?

【问题讨论】:

    标签: macos screen-capture


    【解决方案1】:

    3 分钟后找到了解决方案,但我想我会分享这些信息,因为其他人也需要它:)

    如果你有多个屏幕,你将不得不传递更多的文件名,所以如果你有两个屏幕,你会这样做:

    screencapture screen1.png screen2.png
    

    如果您仔细阅读,此消息将被隐藏!

    files   where to save the screen capture, 1 file per screen
    

    【讨论】:

      【解决方案2】:

      此脚本有效:

      while [ 1 ]; do 
        date=$(date "+%Y%m%dT%H%M%S")
        screencapture -x -D 1 ~/Desktop/"screen_${date}.png"
        sleep 2
       
        date=$(date "+%Y%m%dT%H%M%S")
        screencapture -x -D 2 ~/Desktop/"screen_${date}.png"
        sleep 2
      done
      

      -D 1 和 -D 2 命令指的是连接的监视器

      【讨论】:

        猜你喜欢
        • 2012-04-19
        • 2010-12-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-02-26
        • 1970-01-01
        • 2013-02-25
        • 2017-03-15
        相关资源
        最近更新 更多