AppleScript or Shell Script?

You need to use NSAppleScript to call AppleScript in a Sandboxed application, MBS has this and so does my Sandbox Kit (which is exclusively sold through the Omegabundle at the moment).

OSAScript console function may work at the moment, but it’s not the correct way to use AppleScript from a Sandboxed application, and it may be blocked in any future update.

If that really is the only way, Apple will reject your application as you cannot script System Events, Finder or anything else that might allow your application to do naughty things.[quote=166094:@Richard Summers]Ok - I just ran my applescript from within the AppleScript Editor (locally), and it inserted the text correctly in the Xojo IDE.[/quote]
Unless Xojo supports Apple Script, you’re going to be out of luck on the MAS. Even if you simulate key presses, this will get your application blocked.
A easy and allowed possibility, is to use a floating window and allow the user to drag text from the window into the Xojo IDE.