This took me a while to figure out so I thought I would share. As per Keyboard Maestro Wiki: " Keyboard Maestro does NOT replicate OSX's interactive capture area functionality – e.g. ⌘⇧4."
This can be done with Python using the "Execute a Shell Script" action. It does however require the installation of the PyAutoGUI package along with python. To install this package, you would only need to open a Terminal and type:
pip install pyautogui
Here is a code sample:
#!/usr/bin/env python
import pyautogui
from time import sleep
# moves cursor to desired starting coordinates
pyautogui.moveTo(450, 450)
# sleep for 1 second (like adding a pause in Keyboard Maestro)
sleep(1)
# Simulate the Command+Shift+4 keystroke
pyautogui.hotkey("command", "shift", "4")
sleep(1)
# move cursor relative to current position right 225 pixels, down 75 pixels, over 2 seconds, holding down the left mouse button
pyautogui.dragRel(225, 75, 2, button='left')
sleep(1)
# release mouse button
pyautogui.mouseUp()
# Area screenshot will be save to default screenshot folder (usually the desktop unless changed)
The documentation for the pyautogui package is here.
Hope that helps somebody.