With https://forum.xojo.com/49955-questions-about-nsapplescriptmbs-determinepermissiontoautomatet I have implemented a nice check if my app can do AppleScript for different apps. Only one problem remains:
The apps in System Preferences/Security & Privacy/Automation are dynamic. If "My App.debug" is deleted after the debug session the entry in the System Preferences goes away. As a result when debugging you get a lovely popup for each debug run for each AppleScripted app.
Does anyone have a better solution than doing a dummy app with the name "My app.debug" and the bundle id of the original app and building the app?