【问题标题】:Applescript screencapture second monitorApplescript 屏幕捕获第二台显示器
【发布时间】:2014-04-30 17:14:55
【问题描述】:

我想通过 Applescript 捕捉我的第二台外接显示器的整个屏幕。当我按下 CMD + SHIFT + 3 时,我会从每台显示器获得两张图像。

有什么建议吗?

谢谢 克里斯

【问题讨论】:

    标签: xcode macos applescript


    【解决方案1】:

    尝试只删除第一个监视器的文件:

    screencapture monitor1.png monitor2.png;rm monitor1.png
    

    -m 只捕获主监视器,但没有指定另一个监视器的选项:

    $ screencapture -h
    screencapture: illegal option -- h
    usage: screencapture [-icMPmwsWxSCUtoa] [files]
      -c         force screen capture to go to the clipboard
      -C         capture the cursor as well as the screen. only in non-interactive m
    odes
      -d         display errors to the user graphically
      -i         capture screen interactively, by selection or window
                   control key - causes screen shot to go to clipboard
                   space key   - toggle between mouse selection and
                                 window selection modes
                   escape key  - cancels interactive screen shot
      -m         only capture the main monitor, undefined if -i is set
      -M         screen capture output will go to a new Mail message
      -o         in window capture mode, do not capture the shadow of the window
      -P         screen capture output will open in Preview
      -s         only allow mouse selection mode
      -S         in window capture mode, capture the screen not the window
      -t<format> image format to create, default is png (other options include pdf, 
    jpg, tiff and other formats)
      -T<seconds> Take the picture after a delay of <seconds>, default is 5
      -w         only allow window selection mode
      -W         start interaction in window selection mode
      -x         do not play sounds
      -a         do not include windows attached to selected windows
      -r         do not add dpi meta data to image
      -l<windowid> capture this windowsid
      -R<x,y,w,h> capture screen rect
      files   where to save the screen capture, 1 file per screen
    

    【讨论】:

    • +1 用于从可怜的 man 页面找出如何定位 other 监视器:使用附加的位置文件名参数。虽然没有直接支持的跳过监视器的方法,但有两个技巧:(a) 使用相同的文件名两次,依赖于文件的写入顺序,这样最后一个监视器以“获胜”为目标(尽管这是一个可能不想依赖的实现细节),(b)指定/dev/null作为第一个文件名;虽然这可行,但需要注意的是会报告错误消息并且退出代码为 1,因此很难检测到实际故障。
    • 感谢您的回答...同时我找到了另一个解决方案。只需使用 -RX,Y,W;H 并取负 X
    猜你喜欢
    • 2016-12-11
    • 1970-01-01
    • 1970-01-01
    • 2014-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-26
    • 2020-01-19
    相关资源
    最近更新 更多