PAsting into SPSS syntax window

I have a cript that places some text on the clipboard. I need to paste this into a syntax window. SPSS is not scriptable I know but I thought that this sort of work around might help.
set theApp to “SPSS 11 for MAC OS X”
tell application theApp to activate
try
tell application “System Events”
tell process theApp
set frontmost to true
keystroke “V” using command down
end tell
end tell
on error
display dialog “It didn’t work!”
end try

Well I either get the error dialog, or I get a “v” in the text syntax field.

IS there another way of pasting the clipboard into this app?

TIA

Using a capital v is the same as saying shift+command+v, which doesn’t do anything.
Try: keystroke “v” using command down
You may have to put in a one or two second delay.
Also, you might have better luck using the free UI Element Inspector or PreFab Software’s better UI Browser. It will allow you to target the input area. I don’t have SPSS so I can’t say exactly how it would work.

Thanks Dennis
tried little v and capital V - no difference. identified the menuitem and prepared appropriate nested tell statements…still no luck.

I can get it to run straight out of UI browser (interestingly), but not script edit.

Maybe some applications are just too dim to be controlled indirectly?

Any other suggestions gratefully received

Lumpo

lumpo,

Some claim to have better success with UI scripting if delays are added before and or after the keystroke commands.

delay 2 --2second delay

Andy