Error pasting string to BBEdit

error, about line (paste the str)

-----unsuccessful.((?------
set str to “test”
tell application “BBEdit Lite 6.1”
activate
paste the str
end tell

Thanks a lot.

Change the 'set str to “test”’ to:
set the clipboard to “test”

then instead of ‘paste the str’:
paste

when i type paste, it says “The variable paste is not defined”.

what i want to do is to create a small applescript that will work with a RealBasic application i wrote to paste a string into the active application in the system.

i tried other codes before but none of them work with all applications, i managed to paste successfully into bbedit for instance, but bbedit lite or the mail application in os x won’t recognize it.

is there any other solution for this? thanks a lot.

Only using UI Scripting, bringing the app to the foreground and typing “apple+V”. Search this forum for “ui scripting keystroke”.