Output to OS
I have been using an XKeys XF-10 3-button USB foot pedal on a 2012-ish iMac / 10.13.6 for many years ands it works wonderfully. I often wonder why the creator gave us only two hands; the pedal fills the gap.
Therefore, I purchased one for my 2020 MinMac / 14.6.1 as well (from eBay) and downloaded the latest version of the programming software, ControllerMate, which purportedly supports OSX 14.
It doesn’t. Maybe it’s the OS, maybe the silicon. Messages to the company, p.i. engineering, so far fell on deaf ears.
So I built a patcher that accesses the pedal through the HID system and properly returns the buttonNr-dn/up data.

The issue is to translate the bang to a message to another app, e.g. sending “Cycling ’74” to the browser's search bar.
I suspect an AppleScript is called for, but I don’t know how to invoke an AppleScript from Max, nor do I have any idea what it should contain.
Attempts to accomplish this through shell met with no success so far.
Any ideas? I'd be grateful!
Here is an Applescript to type and press "Return":
tell application "System Events"
set textToType to "your text here"
keystroke textToType
key code 36 #delete this line if you don't need the script to press Return
end tell
Save it with any name (e. g. "my Script")
then you can call it using osascript via shell