Applescript not working

Hi all. Trying to get a very simple applescript working. Im on Catalina. It literally sends a key command to an app to change scene ( Ecamm) Script is this:

tell application "Ecamm Live"
activate
end tell
tell application "System Events"
	keystroke "1" using command down
end tell

This works fine wen run from script editor. However, when I include the script in xojo it doesnt. It boots the application if its not open, so it seems to send but doesn’t change the scene. Ive tried with delays etc and still no joy. Any ideas gratefully recieved.

Ive tried the demo project and it works (although opens script editor not itunes as named which is right for code)

Please check the forum about AppleScript and Catalina. The topic has been discussed a couple of times.

On Catalina AppleScript needs special authorisation. At least you need to sign your app and request authorisation.

Thanks for the reply. SO does that mean I need a developer account etc? I wasn’t planning on releasing via app store

I recently wrote a blog article on getting Apple Script to work, it uses App Wrapper 3 (so I need to update it for App Wrapper 4).
https://www.ohanaware.com/blog/202040/Apple-Script-Catalina-and-Xojo-made-Mac-Apps.html

You still need to annually pony up $99 to Apple to release software, even on your own site.

Your app will be rejected from the  App Store because apps sold through the App Store are not allowed to script “System Events”, unless you can convince the App Store review team otherwise or are a large company with loads’a’cash.