【问题标题】:Screencapture -l : illegal option?Screencapture -l : 非法选项?
【发布时间】:2013-09-06 21:59:09
【问题描述】:

我在 SO 上的许多页面(例如这里:https://apple.stackexchange.com/questions/56561/how-do-i-find-the-windowid-to-pass-to-screencapture-l)中看到您必须使用以下命令: screencapture -l 以便在给定 ID 的情况下捕获单个窗口。

但是,当我尝试在终端中输入 screencapture -l 时出现此错误:

screencapture: 非法选项 -- l

我检查了一个参考,实际上我看不到 -l 作为屏幕捕获的可能属性:http://guides.macrumors.com/screencapture

你怎么解释这个?我该如何解决这个问题?

【问题讨论】:

    标签: macos terminal command-line-interface screen-capture


    【解决方案1】:

    不确定这是一个编程问题还是更适合 apple.stackexchange.com 的问题,但无论如何:

    当我运行“screencapture -l”时,我看到了:

    screencapture: illegal option -- l
    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 modes
      -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
    

    他们没有在上面的输出中说清楚(“windowsid”?),但看起来“-l”选项需要一个窗口 id,因此屏幕捕获将捕获屏幕上的单个窗口。

    【讨论】:

    • 感谢您的回答。所以基本上你是说我们需要提供一个windowsid才能让它工作。但是,如果我输入这样的命令: screencapture -l$(osascript -e 'tell app "Safari" to id of window 1') test.png 按照这里的建议(apple.stackexchange.com/questions/56561/…) 它也不起作用。给我同样的错误。
    猜你喜欢
    • 2013-12-28
    • 1970-01-01
    • 2014-10-10
    • 1970-01-01
    • 1970-01-01
    • 2021-09-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多