16

Under OS X, I need to take a screenshot of the same specific screen area. I know I can press hotkeys to grab the entire screen, or an area of the screen, but then I always have to select it.

Can I configure OS X to always create a screenshot of the same part of the screen?

0

4 Answers 4

22

You can use the screencapture command line utility. It includes (amongst others) the following options:

-x         do not play sounds
-R<x,y,w,h> capture screen rect
files   where to save the screen capture, 1 file per screen

So, in your case, to grab a screenshot with the top left corner at 20/20, creating a 640x380 window:

screencapture -x -R20,20,640,380 ~/Desktop/test.png

You could put this command into your crontab to have it execute repeatedly, or simply use a loop that runs in a Terminal window. In that case, we will create a screenshot every second (sleep 1), and the output file will be named screen_YYMMDDTHHMMSS accordingly.

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

You could also create an Automator action or AppleScript to run a shell script like the above. For example, open Script Editor, then paste this:

do shell script "date=$(date '+%Y%m%dT%H%M%S'); screencapture -x -R20,20,640,380 ~/Desktop/screen_${date}.png"

It should look like this:

Save that script and use FastScripts to easily assign a keyboard shortcut.

1
  • Thank you so much for documenting the -R option! Sadly not included in the man page. Oct 13, 2016 at 21:55
8

If you are open to using an app/utility, I would highly recommend Skitch:

https://evernote.com/skitch/

It has a shortcut for "Previous Snapshot Area."

(In addition you can capture a selection using a timer, capture the whole screen, just a window, or just a menu.)

It's free and has a ton of features including editing / annotations, quick and easy sharing, etc.

1
  • Hint, after "Previous Snapshot Area", you need to cmd+c (while Skitch is open) to get the snapshot into the clipboard.
    – Sida Zhou
    Nov 23, 2020 at 3:38
6

Not sure if this was introduced in newer macOS versions, but now one can just use cmd + shift + 5, select desired area and choose "Capture Selected Portion" from the toolbar below. After selecting area once, it stays exactly the same on the following screen capture calls.

1

Copied from my own answer at Ask Different
You can now do this natively, Apple added to the previous capture commands of Cmd ⌘ Shift ⇧ 3 and Cmd ⌘ Shift ⇧ 4 by adding Cmd ⌘ Shift ⇧ 5 [This functionality was added in Mojave.]

This exposes all the preferences for the Screenshot process right there on screen. If you select a specific area, then it will return to this same area [& selected Preferences in the Options button] every time you trigger it, until you change it. You take the shot with the Capture button, or Return/Enter key. It will otherwise wait for you. You can also add a timer, change location, etc that you previously had to access from terminal.

enter image description here

I've manipulated the window position in this capture so you can see both in the same shot.
BTW, you can screenshot the screenshot mechanism using Cmd/Shift/3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .