How to get output from a Shorctuts app shortcut?

I'm trying to create a menu item that runs a shortcut. I've figured out how to assign the button to run the shortcut, I just don't know how to get the shortcut's output. The shortcut is configured to output its result:

For example, if I wanted to add the output to the clipboard or transform it with javascript, what is the next step?

Thank you

You would need to use scripting for that.

So basically you'd use the predefined action "Run Real Java Script" with a script like this:

async function someJavaScriptFunction() {
  let shortcut = "some name";
  let input = "some input"; // optional
  let result = await runAppleShortcut({name: shortcut, input: input});
  // example transform
  result = result.toUpperCase()
  // paste the transformed text?
  await paste_text({text: result})
  return result;
}

https://docs.folivora.ai/docs/1106_java_script.html#4-running-shortcuts-from-apples-shortcuts-app

Maybe describe an exact example usecase then I can post a script for it

Ah! Ok. Thank you, @Andreas_Hegenberg. I'll give that a try.