Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

carterx

macrumors member
Original poster
Dec 4, 2006
58
13
I've been using this for some years now with ARD to log into whole labs when we are doing work on them. As you can see below I would use this command to have an entire lab login for me. As of OS X Mavericks it would see you cannot use osascript -e? Can someone help me create a method that works with Mavericks that does the following?

Code:
osascript -e 'tell application "System Events" to keystroke “xxxxusernamexxxx"'; \
osascript -e 'tell application "System Events" to delay 1.0'; \
osascript -e 'tell application "System Events" to keystroke return'
osascript -e 'tell application "System Events" to delay 4.0'; \
osascript -e 'tell application "System Events" to keystroke “xxxxpasswordxxxx"'; \
osascript -e 'tell application "System Events" to delay 1.0'; \
osascript -e 'tell application "System Events" to keystroke return’

Thank you!
 
I've been using this for some years now with ARD to log into whole labs when we are doing work on them. As you can see below I would use this command to have an entire lab login for me.

I use that exact script, with different timings, on a regular basis with 10.9.x systems in a lab. It works fine, though you need to be sure the systems are set to type the username and password in, not select from a list of users.
Sometimes the username field will not be active on a computer that's been up for a while, so usually I'll reboot machines first before running the script.
EDIT: in my script, the second keystroke is Tab, not Return.
Also, in the code you pasted, you have a smart quote before the username and password fields.
 
I think automator now uses smart quotes by default.

Right click and uncheck all the smart stuff under substitutions.
 
Last edited:
I found this somewhere on the Net. I've been using it trough ARD "Send UNIX Command...".

To works, the login window must be set to type the username and password in, not select from a list of users.

/usr/bin/osascript <<EndOfMyScript
tell application "System Events"
keystroke "user_name"
delay 3.0
keystroke return
delay 3.0
keystroke "user_password"
delay 3.0
keystroke return
delay 3.0
end tell
EndOfMyScript

----
NOTE: sometimes Mavericks put the cursor in the "Password" field instead in the "User Name", which brakes the script. To fix it, just include one more line before "keystroke "user_name"". It will put the cursor back in the "Name":

/usr/bin/osascript <<EndOfMyScript
tell application "System Events"
keystroke tab
keystroke "user_name"
.....

Or you can run separate script, before the main one:

/usr/bin/osascript <<EndOfMyScript
tell application "System Events"
keystroke tab
end tell
EndOfMyScript

Good luck!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.