Filter the Number from OCR

I want to OCR this window and extract this 6 digit number code; I am achieving this currently by using shortcut app, is it possible to do only with BetterTouchTool

Currently this take screenshot and the shortcut ocr and filter out the number and again in BetterTouchTool, deleting that latest screenshot without confirmation via shell command @Andreas_Hegenberg

You can use BTT's OCR action followed by some JS that extracts the number:

Here is some JS that would achieve this:

async function findSixDigitCode() {
 let text = await get_string_variable("ocr_result");
  const candidates = text.match(/\d(?:\s*\d)*/g) ?? [];

  for (const candidate of candidates) {
    const digits = candidate.replace(/\D/g, "");

    if (digits.length === 6) {
      return digits;
    }
  }

  return null;
}

Note: this does not yet do anything with the extracted digits, what exactly should happen after they have been extracted?

I want 6 digit to be typed out @Andreas_Hegenberg

In that case your javascript could either set the recognized number as a variable, or it could type the number directly:

Example: Save to Variable: recognized_code

async function findSixDigitCode() {
 let text = await get_string_variable("ocr_result");
  const candidates = text.match(/\d(?:\s*\d)*/g) ?? [];

  for (const candidate of candidates) {
    const digits = candidate.replace(/\D/g, "");

    if (digits.length === 6) {
	  await set_string_variable({variableName: "recognized_code", to: digits});
      return digits;
    }
  }

  return "no code found";
}

That variable can then be used in the type text action:

Alternatively you can paste/type directly from JS:

  let result = await paste_text({text: digits, format: 'NSPasteboardTypeString', insert_by_pasting: true});