Skip to content

Instantly share code, notes, and snippets.

@rickychilcott
Last active December 11, 2015 04:48
Show Gist options
  • Select an option

  • Save rickychilcott/4547214 to your computer and use it in GitHub Desktop.

Select an option

Save rickychilcott/4547214 to your computer and use it in GitHub Desktop.
Login to a Mac via ARD
username=YYYYYYYY
password=XXXXXXXX
#Sanity checks
if [ $username = YYYYYYYY ]; then
echo "You need to set the username"
exit 1
fi
if [ $password = XXXXXXXX ]; then
echo "You need to set the password"
exit 2
fi
#Close the Bluetooth setup assistant, if there is one
osascript <<EOT
tell application "System Events"
keystroke "w" using {command down}
end tell
EOT
#Wait a little bit for everything to work
sleep 5
#Type in the username, password, and press return
osascript <<EOT
tell application "System Events" to keystroke "$username"
tell application "System Events" to delay 2
tell application "System Events" to keystroke tab
tell application "System Events" to delay 2
tell application "System Events" to keystroke "$password"
tell application "System Events" to delay 2
tell application "System Events" to keystroke return
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment