problem writing in scrivener from AppleScript

I wrote an apple script to read my Mendeley library and type the citation key into the document. It works fine when I run it from within Automator, but when I try to run it from a shortcut key in Scrivener it times out. I have the following lines in my script:

tell application "Scrivener" activate tell application "System Events" keystroke citeKey end tell end tell

I should note that the script previously does a “choose from list” action which probably takes the focus away from Scrivener. I thought the “activate” was supposed to put it back?

EDIT: the timeout seems to happen on the “activate” event.

Well, I’m fairly ignorant about scripting, but I do know that AppleScript support is still lacking in Scrivener. See this thread:

viewtopic.php?f=5&t=1921

Exactly what significance that might have in the present case I leave to others more knowledgeable than I.

Martin.