Select and save an area of screen to be captured in another action

I am often on Zoom/Teams/WebEx calls and want to build an action that captures the presenter's slide, so I can paste in my notes. Because each of these are slightly different and sometimes the presenter's picture is to the side, the area for the slide is in a slightly different place every time.

I made an action, I'll call Action 1, that captures a custom areas of the screen, and pastes it into my notes program. I am trying to figure out how (or if it is possible) to create an Action 2, where I could select the area to capture one time and set some variable so that the Action 1 would always select that area. This seems like it would be easier than having to go in and edit the Action 1 every time.

Thanks for any tips

I hope I understood correctly. This will require some (simple) Java Script and also one of the latest versions of BTT because the "Measure Area" action has only been added in the latest builds (Standalone “Template Window” Action for Measuring & Copying Dimensions - #4 by Andreas_Hegenberg )

Here is an example preset:
dynamic_screenshot.bttpreset (7.2 KB)

In this preset, pressing cmd+opt+s let's you select an area of your screen.
Pressing cmd+opt+c will capture the last selected area and save it to your downloads folder.

async function saveDimensions() {
    let x = await get_number_variable("BTTActionMeasuredX");
    let y = await get_number_variable("BTTActionMeasuredY");
    let width = await get_number_variable("BTTActionMeasuredWidth"); 
    let height = await get_number_variable("BTTActionMeasuredHeight");

    // format in any way you want
    let slideFrame = `${x},${y},${width},${height}`;

	await set_string_variable({variableName: "SlideFrameToCapture", to: slideFrame})

		
    return slideFrame;
}

async function captureScreenshot() {
	let frameToCapture = await get_string_variable("SlideFrameToCapture");
let result = undefined;
result = await trigger_action({json: JSON.stringify({
  BTTPredefinedActionType: 169,
  BTTScreenshotOptions: `-R;;${frameToCapture};;-t;;png;;~/Downloads/Screenshot_{datetime}_{random}.png;;`,
  BTTScreenshotDateFormat: 'yyyy-MM-dd HH.mm.ss'
}), wait_for_reply: true});

}

Hey Andreas, Can the area also be selected by creating a rectangle with mouse/trackpad?

You can resize/move the red measuring rectangle with your mouse, but it currently doesn't support dragging like when taking a screenshot. This is planned, but might take a while.

You could probably script something that captures two mouse locations and calculate the rectangle from them.

Yeah that's what I meant. I'll take a look at