Remote login script fails on run, but works the second time.

DBI_Support
New Contributor

I'm using the following to log into over 300 remote systems. The first time I run it on any system it fails, with an execution error, error type -10810. When I run it second time, the script runs, with the expected result.

osascript <<EOF
tell application "System Events"
keystroke "$4"
keystroke tab
delay 0.5
keystroke "$5"
delay 0.5
keystroke return
end tell
EOF

It's be nice to get this to run correctly, the first time I run it in Casper Remote. Anyone have any ideas as to why the first run fails, but the second time is the charm?

Thanks in advance!

2 REPLIES 2

CapU
Contributor III

The first time I ran it the user name was not populated....
I changed the delay to 1

osascript <<EOF
tell application "System Events"
keystroke "username"
keystroke tab
delay 1
keystroke "password"
delay 0.5
keystroke return
end tell
EOF

DBI_Support
New Contributor

I attempted that, as well as changing the second delay to a full second, but the results were the same. The first run of the script fails, but if I retry and run it again, it works perfectly. I'm not certain why.