10

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

2 Answers 2

18

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
7

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.