Log in Error Messages

Hello,
Hope I’m posting to the correct place. I didn’t get a workable answer from Apple’s Remote Desktop forum.

We have a user account on our lab computers for required testing. After logging in to the test account, the test program (NWEA TestTaker) launches, and a user name and password is required to continue. I’m using the same script to log in to both accounts, the only difference being different username/password.
When using a UNIX command to simultaneously login from Remote Desktop, I can log in to the test account with no problem, but the log in command for the test program fails with the following message”

RegisterProcess failed (error = -50)
/bin/bash: line 9: 337 Abort trap osascript <<EOF
tell application “System Events”
keystroke “username”
keystroke tab
delay 0.5
keystroke “password”
delay 0.5
keystroke return

EOF

Any ideas? Below is the script I’m using. Thank you very much.

osascript <<EOF
tell application “System Events”
keystroke “username”
keystroke tab
delay 0.5
keystroke “password”
delay 0.5
keystroke return
end tell
EOF

I think you need a dash in the line like so…
osascript - <<EOF

The dash tells osascript to read from the standard input. And if the dash doesn’t help you then maybe you need to tell your application to activate so it comes to the front so your keystrokes are applied to it… like so…

osascript - <<EOF
tell application “NWEA TestTaker” to activate
tell application “System Events”
keystroke “username”
keystroke tab
delay 0.5
keystroke “password”
delay 0.5
keystroke return
end tell
EOF

and one last thought. When using “here documents” like you’re doing, you may have to quote your “here document word” i.e. EOF. I’m not sure exacly how it works because I don’t have much experience with it, but it has something to do with parameter expansion. If EOF is unquoted then all lines of the here-document are subjected to parameter expansion. So you may try…

osascript - <<‘EOF’

Anyway, that’s all I can think of. Good luck.