Skip to main content
added 227 characters in body
Source Link
markhunte
  • 12.3k
  • 1
  • 34
  • 55

This is quite easy to do.

The Built in Screencapture has a command line option to capture a rect area. This is a rectangle with a screen coordinate point, width and hight, x,y,w,h

We can use this in an Automator.app Service workflow and then give the service that it creates a hotkey/shortcut in the keyboard services system preferences.

First we create the Service workflow in Automator.

Open Automator and a new Service Workflow document.

Set :

service receives: none In : Any Application

Add a Run Applescript action.

Type or paste this code into the Run Applescript action, replacing the default code.

  set theDate to do shell script "date +%Y_%m_%d_%H%M%S"
set theTempPath to POSIX path of (path to desktop)
set thePath to theTempPath & "screenCapture_" & theDate & ".png"


do shell script "screencapture -R320,210,848,440 -tpng" & space & quoted form of thePath

enter image description here

The code above will create a timestamp string to add onto the end of the file name.

This serves two purposes, 1, you can visually see when they where taken, 2 and more important, the files will no be overwritten by the next capture as the name will be different.

-R320,210,848,440 is the Rect option: x,y,w,h

-tpng is the file type format option: png

& space we need a space between the options and the next part of the command.

**&quoted form of" escapes spaces and illegal characters that the command line will error at if we do not guard against them.

& thePath adds the file output path which includes the file name

The ampersands & are applescript syntax to say this and this.


Save the Service. You will be prompted to give it a name.

Now open the system Preferences and go to the keyboard system pref. Then the Shortcuts Tab and finally the services selection panel.

enter image description here

Scroll right down to the bottom to the General group

Select your service and give it a shortcut. ( remember to use one that does not clash with any other apps you have that use shortcuts: I show I used Cmd + shift +R, but I changed it in mine as I found a clash with Safari reader shortcut)

In most cases thisthe shortcut will be picked up by apps straight away but some may need to be closed and reopened.


An aside:

The files are set to land on the desktop.

You can change this in a couple of ways.

But to save me adjusting this for everyone, the easiest thing to do is add a move finder items action

First add this bit of code to the end of the code above:

return (POSIX file thePath) as alias

This will pass on the file path to the next Automator action.

Then add a move finder items action and choose your destination from it's dropdown menu.

enter image description here

This is quite easy to do.

The Built in Screencapture has a command line option to capture a rect area. This is a rectangle with a screen coordinate point, width and hight, x,y,w,h

We can use this in an Automator.app Service workflow and then give the service that it creates a hotkey/shortcut in the keyboard services system preferences.

First we create the Service workflow in Automator.

Open Automator and a new Service Workflow document.

Set :

service receives: none In : Any Application

Add a Run Applescript action.

Type or paste this code into the Run Applescript action, replacing the default code.

  set theDate to do shell script "date +%Y_%m_%d_%H%M%S"
set theTempPath to POSIX path of (path to desktop)
set thePath to theTempPath & "screenCapture_" & theDate & ".png"


do shell script "screencapture -R320,210,848,440 -tpng" & space & quoted form of thePath

enter image description here

The code above will create a timestamp string to add onto the end of the file name.

This serves two purposes, 1, you can visually see when they where taken, 2 and more important, the files will no be overwritten by the next capture as the name will be different.

-R320,210,848,440 is the Rect option: x,y,w,h

-tpng is the file type format option: png

& space we need a space between the options and the next part of the command.

**&quoted form of" escapes spaces and illegal characters that the command line will error at if we do not guard against them.

& thePath adds the file output path which includes the file name

The ampersands & are applescript syntax to say this and this.


Save the Service. You will be prompted to give it a name.

Now open the system Preferences and go to the keyboard system pref. Then the Shortcuts Tab and finally the services selection panel.

enter image description here

Scroll right down to the bottom to the General group

Select your service and give it a shortcut.

In most cases this will be picked up by apps straight away but some may need to be closed and reopened.


An aside:

The files are set to land on the desktop.

You can change this in a couple of ways.

But to save me adjusting this for everyone, the easiest thing to do is add a move finder items action

First add this bit of code to the end of the code above:

return (POSIX file thePath) as alias

This will pass on the file path to the next Automator action.

Then add a move finder items action and choose your destination from it's dropdown menu.

enter image description here

This is quite easy to do.

The Built in Screencapture has a command line option to capture a rect area. This is a rectangle with a screen coordinate point, width and hight, x,y,w,h

We can use this in an Automator.app Service workflow and then give the service that it creates a hotkey/shortcut in the keyboard services system preferences.

First we create the Service workflow in Automator.

Open Automator and a new Service Workflow document.

Set :

service receives: none In : Any Application

Add a Run Applescript action.

Type or paste this code into the Run Applescript action, replacing the default code.

  set theDate to do shell script "date +%Y_%m_%d_%H%M%S"
set theTempPath to POSIX path of (path to desktop)
set thePath to theTempPath & "screenCapture_" & theDate & ".png"


do shell script "screencapture -R320,210,848,440 -tpng" & space & quoted form of thePath

enter image description here

The code above will create a timestamp string to add onto the end of the file name.

This serves two purposes, 1, you can visually see when they where taken, 2 and more important, the files will no be overwritten by the next capture as the name will be different.

-R320,210,848,440 is the Rect option: x,y,w,h

-tpng is the file type format option: png

& space we need a space between the options and the next part of the command.

**&quoted form of" escapes spaces and illegal characters that the command line will error at if we do not guard against them.

& thePath adds the file output path which includes the file name

The ampersands & are applescript syntax to say this and this.


Save the Service. You will be prompted to give it a name.

Now open the system Preferences and go to the keyboard system pref. Then the Shortcuts Tab and finally the services selection panel.

enter image description here

Scroll right down to the bottom to the General group

Select your service and give it a shortcut. ( remember to use one that does not clash with any other apps you have that use shortcuts: I show I used Cmd + shift +R, but I changed it in mine as I found a clash with Safari reader shortcut)

In most cases the shortcut will be picked up by apps straight away but some may need to be closed and reopened.


An aside:

The files are set to land on the desktop.

You can change this in a couple of ways.

But to save me adjusting this for everyone, the easiest thing to do is add a move finder items action

First add this bit of code to the end of the code above:

return (POSIX file thePath) as alias

This will pass on the file path to the next Automator action.

Then add a move finder items action and choose your destination from it's dropdown menu.

enter image description here

added 7 characters in body
Source Link
markhunte
  • 12.3k
  • 1
  • 34
  • 55

This is quite easy to do.

The Built in Screencapture has a command line option to capture a rect area. This is a rectangle with a screen coordinate point and, width and hight, x,y,w,h

We can use this in an Automator.app ServiceService workflow and then give the service that it creates a hotkey shortcut/shortcut in the keyboard services system preferenceskeyboard services system preferences.

First we create the Service workflow in Automator.

Open Automator and a new Service Workflow document.

Set :

service receives: none In : Any Application

Add a Run Applescript action.

Type or paste this code into the Run Applescript action, replacing the default code.

  set theDate to do shell script "date +%Y_%m_%d_%H%M%S"
set theTempPath to POSIX path of (path to desktop)
set thePath to theTempPath & "screenCapture_" & theDate & ".png"


do shell script "screencapture -R320,210,848,440 -tpng" & space & quoted form of thePath

enter image description here

The code above will create a timestamp string to add onto the end of the file name.

This serves two purposes, 1, you can visually see when they where taken, 2 and more important, the files will no be overwritten by the next capture as the name will be different.

-R320,210,848,440 is the Rect option: x,y,w,h

-tpng is the file type format option: png

& space we need a space between the options and the next part of the command.

**&quoted form of" escapes spaces and illegal characters that the command line will error at if we do not guard against them.

& thePath adds the file output path which includes the file name

The ampersands & are applescript syntax to say this and this.


Save the Service. You will be prompted to give it a name.

Now open the system Preferences and go to the keyboard system pref. Then the Shortcuts Tab and finally the services selection panel.

enter image description here

Scroll right down to the bottom to the General group

Select your service and give it a shortcut.

In most cases this will be picked up by apps straight away but some may need to be closed and reopened.


An aside:

The files are set to land on the desktop.

You can change this in a couple of ways.

But to save me adjusting this for everyone, the easiest thing to do is add a move finder items action

First add this bit of code to the end of the code above:

return (POSIX file thePath) as alias

This will pass on the file path to the next Automator action.

Then add a move finder items action and choose your destination from it's dropdown menu.

enter image description here

This is quite easy to do.

The Built in Screencapture has a command line option to capture a rect area. This is rectangle with a screen coordinate point and width and hight, x,y,w,h

We can use this in an Automator.app Service workflow and then give the service that it creates a hotkey shortcut in the keyboard services system preferences.

First we create the Service workflow in Automator.

Open Automator and a new Service Workflow document.

Set :

service receives: none In : Any Application

Add a Run Applescript action.

Type or paste this code into the Run Applescript action, replacing the default code.

  set theDate to do shell script "date +%Y_%m_%d_%H%M%S"
set theTempPath to POSIX path of (path to desktop)
set thePath to theTempPath & "screenCapture_" & theDate & ".png"


do shell script "screencapture -R320,210,848,440 -tpng" & space & quoted form of thePath

enter image description here

The code above will create a timestamp string to add onto the end of the file name.

This serves two purposes, 1, you can visually see when they where taken, 2 and more important, the files will no be overwritten by the next capture as the name will be different.

-R320,210,848,440 is the Rect option: x,y,w,h

-tpng is the file type format option: png

& space we need a space between the options and the next part of the command.

**&quoted form of" escapes spaces and illegal characters that the command line will error at if we do not guard against them.

& thePath adds the file output path which includes the file name

The ampersands & are applescript syntax to say this and this.


Save the Service. You will be prompted to give it a name.

Now open the system Preferences and go to the keyboard system pref. Then the Shortcuts Tab and finally the services selection panel.

enter image description here

Scroll right down to the bottom to the General group

Select your service and give it a shortcut.

In most cases this will be picked up by apps straight away but some may need to be closed and reopened.


An aside:

The files are set to land on the desktop.

You can change this in a couple of ways.

But to save me adjusting this for everyone, the easiest thing to do is add a move finder items action

First add this bit of code to the end of the code above:

return (POSIX file thePath) as alias

This will pass on the file path to the next Automator action.

Then add a move finder items action and choose your destination from it's dropdown menu.

enter image description here

This is quite easy to do.

The Built in Screencapture has a command line option to capture a rect area. This is a rectangle with a screen coordinate point, width and hight, x,y,w,h

We can use this in an Automator.app Service workflow and then give the service that it creates a hotkey/shortcut in the keyboard services system preferences.

First we create the Service workflow in Automator.

Open Automator and a new Service Workflow document.

Set :

service receives: none In : Any Application

Add a Run Applescript action.

Type or paste this code into the Run Applescript action, replacing the default code.

  set theDate to do shell script "date +%Y_%m_%d_%H%M%S"
set theTempPath to POSIX path of (path to desktop)
set thePath to theTempPath & "screenCapture_" & theDate & ".png"


do shell script "screencapture -R320,210,848,440 -tpng" & space & quoted form of thePath

enter image description here

The code above will create a timestamp string to add onto the end of the file name.

This serves two purposes, 1, you can visually see when they where taken, 2 and more important, the files will no be overwritten by the next capture as the name will be different.

-R320,210,848,440 is the Rect option: x,y,w,h

-tpng is the file type format option: png

& space we need a space between the options and the next part of the command.

**&quoted form of" escapes spaces and illegal characters that the command line will error at if we do not guard against them.

& thePath adds the file output path which includes the file name

The ampersands & are applescript syntax to say this and this.


Save the Service. You will be prompted to give it a name.

Now open the system Preferences and go to the keyboard system pref. Then the Shortcuts Tab and finally the services selection panel.

enter image description here

Scroll right down to the bottom to the General group

Select your service and give it a shortcut.

In most cases this will be picked up by apps straight away but some may need to be closed and reopened.


An aside:

The files are set to land on the desktop.

You can change this in a couple of ways.

But to save me adjusting this for everyone, the easiest thing to do is add a move finder items action

First add this bit of code to the end of the code above:

return (POSIX file thePath) as alias

This will pass on the file path to the next Automator action.

Then add a move finder items action and choose your destination from it's dropdown menu.

enter image description here

Source Link
markhunte
  • 12.3k
  • 1
  • 34
  • 55

This is quite easy to do.

The Built in Screencapture has a command line option to capture a rect area. This is rectangle with a screen coordinate point and width and hight, x,y,w,h

We can use this in an Automator.app Service workflow and then give the service that it creates a hotkey shortcut in the keyboard services system preferences.

First we create the Service workflow in Automator.

Open Automator and a new Service Workflow document.

Set :

service receives: none In : Any Application

Add a Run Applescript action.

Type or paste this code into the Run Applescript action, replacing the default code.

  set theDate to do shell script "date +%Y_%m_%d_%H%M%S"
set theTempPath to POSIX path of (path to desktop)
set thePath to theTempPath & "screenCapture_" & theDate & ".png"


do shell script "screencapture -R320,210,848,440 -tpng" & space & quoted form of thePath

enter image description here

The code above will create a timestamp string to add onto the end of the file name.

This serves two purposes, 1, you can visually see when they where taken, 2 and more important, the files will no be overwritten by the next capture as the name will be different.

-R320,210,848,440 is the Rect option: x,y,w,h

-tpng is the file type format option: png

& space we need a space between the options and the next part of the command.

**&quoted form of" escapes spaces and illegal characters that the command line will error at if we do not guard against them.

& thePath adds the file output path which includes the file name

The ampersands & are applescript syntax to say this and this.


Save the Service. You will be prompted to give it a name.

Now open the system Preferences and go to the keyboard system pref. Then the Shortcuts Tab and finally the services selection panel.

enter image description here

Scroll right down to the bottom to the General group

Select your service and give it a shortcut.

In most cases this will be picked up by apps straight away but some may need to be closed and reopened.


An aside:

The files are set to land on the desktop.

You can change this in a couple of ways.

But to save me adjusting this for everyone, the easiest thing to do is add a move finder items action

First add this bit of code to the end of the code above:

return (POSIX file thePath) as alias

This will pass on the file path to the next Automator action.

Then add a move finder items action and choose your destination from it's dropdown menu.

enter image description here