> 1) Any idea how I fix whatever is causing this error?
Yes, kinda... although the OS should normally prompt you to authorize this the first time any script is run.
In any case, Automator needs to have Automation and Accessibility enabled in System Preferences -> Security & Privacy -> Privacy. That should prevent this from happening.
> 2) Is there a way to create such an AppleScript that is universal, so I don't have to create separate ones for every app where I want to be able to hotkey my way to this overlay?
No, because there is no standard for doing this. In fact, the rules/syntax can even change from one version of the same application to another - for example, the script you reference for Preview.app doesn't work in Big Sur because Preview.app now considers the menu button as part of toolbar 1 so you need another level of indirection.
The only way you could make this work is to have explicit instructions for each application where you want to use it. Then you have to do something like:
set appName to name of (get application process 1 whose frontmost is true)
so now you know the frontmost app, then:
if appName is "Preview" then
-- code for Preview.app goes here
else if appName is "TextEdit" then
-- code for TextEdit.app goes here
else if appName is "SuperDuperApp" then
-- code for SuperDuper.app goes here
else
-- etc
end if
but this will only work for as many apps as you add to the if clause. That may be sufficient if you only have a handful of apps you care about.
Ultimately, though, this comes down to the fact that UI scripting (where you write a script to emulate user actions/clicks/keypresses/etc.) is a poor way to go about this. If you already need to have application-specific code for each app, then you might as well work out how to directly do what you want (e.g. "save the document in a given location/filename") rather than hacking together what you would do manually.