Running OSA script in Shell Object (MAC OS Ventura 13.1) - Not Working

Zach Y's icon

We're trying to activate the Mac dictation function to write words into a message box without having to manually press the keyboard. We created an OSA script that works in the terminal but is not functioning in the Shell Object.

Our current shortcut to activate it is holding Option + E.

osascript -e 'tell application \"System Events\" to key code 14 using option down'

This is for an assignment due in a week, does anyone have any input or advice?

JBG's icon

Sounds like a permission error. Go to System Settings -> Privacy & Security and check that (a) Max is listed under "Accessibility" and (b) Max is listed under "Automation" and (when expanded) has access to System Events