获取osx screencapture终端工具来捕获两个屏幕

时间:2014-02-10 09:47:16

标签: macos screen-capture

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

screencapture screenshot.png

但如果你CMD + Shift + 3,它会同时显示两个屏幕并将其保存为两个屏幕截图。

手册页有一个参数-m,其中显示Only capture the main monitor,但是你可以看到我没有使用那个参数,你会认为它会占用两个屏幕,但是没有。 / p>

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

如何制作屏幕截图同时拍摄屏幕或编程以截取第二个屏幕?

2 个答案:

答案 0 :(得分:8)

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

如果您有多个屏幕,则必须传递更多文件名,因此如果您有两个屏幕,则可以执行以下操作:

screencapture screen1.png screen2.png

如果您仔细阅读,此功能将被隐藏!

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

答案 1 :(得分:0)

此脚本有效:

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命令是指已连接的监视器

相关问题